Re: Use Visual Studio Code (VSC) to Write, Compile, and Run JXA Scripts #script #vsc


I've now learned the following:

  1. Note that the extension is named “AppleScript” because it also supports AppleScript. But all you need to do is save a file with a .jxa extension and VSC will auto-recognize it as a JSA script.

  2. To compile and run JXA scripts, open the Command Palette with ⌘⇧P, and type “JXA” to see the choices for it. Or, just use these shortcuts:

    • JXA: Run Script – Shift+Opt+R
    • JXA: Compile Script – Shift+Opt+B
    • But you can easily change these if you prefer other, using Key Bindings for Visual Studio Code
      • I prefer the shortcuts used by both Script Editor and Script Debugger:

        JXA: Run Script – ⌘R
        JXA: Compile Script – ⌘K

  3. Creating .scpt File from .jxa File

    Good news. When you compile/run the .jxa file in VSC, it automatically creates a companion .scpt file, which you will need if you want to run the file from a KM Execute JXA from a file, or via FastScripts.


  4. Opening a .scpt File in VSC

    Short answer is you can’t. You will need to save a text file with a .jxa extension.

That's all for now.

Join to automatically receive all group messages.