JXA and Safari Debugger - How to Stop Script Launched in Safari Debugger

Hello - quick question. Trying to learn JXA, to use the scripts from KM.

Based on some great advise here, have been able to use VS Code and Code Runner and use of debugger; statement, to attach scripts to Safari debugger.

However, as silly as it sounds, I have not been able to figure out how to stop the execution once attached to Safari debugger - it seems the script execution has to be completed to remove it from the Safari develop menu.

There has got to be a way to stop the script, make a modification, and launch again in the debugger... Thanks!

And it was indeed silly - it seems I can just close the debugger window and the execution quits.

I think when I last tried to learn JXA, this was not the case.

Not sure if I should delete this question, or leave it here.

@sims, sounds like you are making great progress with VSC and JXA.
May I ask how you went from your JXA script in VSC to debug it in Safari debugger?

Oh - I just used the approach that @DanThomas advised in this post of his.

Installed code runner extension in VS Code, inserted the settings that @DanThomas advised in the settings file of VS Code and saved the JXA file as a .js file and then inserted debugger; in the script, and enabled the Safari develop menu which you advised in the Youtube video of yours. And then when I hit cmd-option-N, the script launches in Safari debugger.

I can't be telling you how to do this, I just copied from @DanThomas and you. :slight_smile:

I know I am "late for the party", but I am just starting to look at JXA, VSCode, and Web Inspector. The advice from @JMichaelTX and @DanThomas has been extremely helpful. To @sims, I believe the correct keyboard shortcut to Run Script in the Code Runner extension is Ctrl-Option-N (not Cmd-Option-N). Keep up the good work, all of you.

2 Likes