Use Case
- Make it Easy to Debug JXA Scripts written in Visual Studio Code (VSC)
- In order to use the Safari JXA Debugger, we must first run the script from Script Editor.
- Simplify this entire process of JXA debugging.
UPDATED: 2021-06-05 18:22 GMT-5
- ADD Video showing how to debug without using Script Editor
Video -- Demo Using Safari JXA Debugger Directly From Visual Studio Code [VSC, vscode]
While the below macro works fine, I have now learned that we really don't need to use Script Editor to debug JXA with Safari.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Video Demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MACRO: Run Current VSC JXA Script in Script Editor
-~~~ VER: 2.0 2021-06-04 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Run Current VSC JXA Script in Script Editor.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
ReleaseNotes
Author.@JMichaelTX
PURPOSE:
-
Run Current VSC JXA Script in Script Editor
- Debug Using Safari JXA Debugger
HOW TO USE
- First, make sure you have followed instructions in the Macro Setup below.
- See the below "How to Use" Comment Action
- This macro is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
MACRO SETUP
-
Carefully review the Release Notes and the Macro Actions
- Make sure you understand what the Macro will do.
- You are responsible for running the Macro, not me. ??
.
Make These Changes to this Macro
- Assign a Trigger to this Macro .
- Move this macro to a Macro Group that is only Active when you need this Macro.
- ENABLE this Macro, and the Macro Group it is in.
- For more info, see KM Wiki article on Macro Activation
.
- For more info, see KM Wiki article on Macro Activation
-
REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
(all shown in the magenta color)- Type ⌃⌘P -- Telll VSC to Set Clipboard to Path of Active File
- Change VSC, or change Action to use your Shortcut
- Type ⌃⌘P -- Telll VSC to Set Clipboard to Path of Active File
REQUIRES:
- KM 9.0+ (may work in KM 8.2+ in some cases)
- macOS 10.12.6 (Sierra)+
- Visual Studio Code (VSC)
- Script Editor
- Safari
TAGS: @VSC @ScriptEditor @Safari @JXA @Debug