VS Code Extension Features¶
This guide is meant to give insight on how to use specific Extendscript for VS Code features.
If you’re looking on how to get up and running with the extension, see Getting Started with the VS Code Debugger.
Breakpoints allow you to stop your code running at a specific line, letting you explore the call stack, variable status, and function arguments at that exact point.
VS Code Breakpoints¶
One advantage of using VS Code is that we can set VS Code breakpoints and have the debugger respect them! See the official Visual Studio article on breakpoints.
You can add in
$.bp() anywhere in your source file, and the debugger will catch on it at the correct place, allowing you to view the call stack / data browser at that point.
This works identically to the
See bp() for more info.
Exporting as Binary¶
In the old Extendscript ToolKit, you could very easily save your projects as an obfuscated binary file. This functionality still exists in the VS Code debugger!
JSXBIN from VS Code¶
To export your script as binary, you have a few options:
With the file open, right-click the document and press ‘Export as Binary’
Open the command palette (Ctrl + Shift + P) and type ‘Export as Binary’
Use the keyboard shortcut for the same command (Ctrl + Shift + J)
JSXBIN from the Command Line¶
The VS Code extension allows you to export either single files or entire directories via the command line, but it takes a bit of work on your end.
While there is a built-in way to do it, it can be a fairly unfriendly process. As an alternative, consider the gulp-accessible npm package jsxbin. It does the same as below, but with much less user involvement.
Both methods above require the VS Code extension be installed.
All of the files are saved in the same directory with the same filename (though the suffix will be .jsxbin). Any passed directories will be recursively traversed.
Within the Extension install directory, there’s a
exportToJSX.jsscript file that accepts a file path or directory to convert. We need to get this path.
Note that you’ll need to swap X.X.X with the current version #
This script accepts a few arguments;
--force: Overwrite the ‘.jsxbin’ file/files if already exists
--name: The ‘.js/.jsx’ script path or path to some directory having these files.
--help: Show this help and exit
Running the script
From your command line, run
node path/to/exportToJSX.js [options] [file/directory]
Exporting a single script
sh node "C:/Users/Dev/.vscode/extensions/adobe.extendscript-debug-1.1.2/public-scripts/exportToJSX.js" "d:/projects/scripting/coolTool.jsx"
Exporting a folder, overwriting
sh node "C:/Users/Dev/.vscode/extensions/adobe.extendscript-debug-1.1.2/public-scripts/exportToJSX.js" --force "d:/projects/scripting/"