I’ve added alert boxes into some of my macros so I can debug easily. What I’m wondering is if it’s possible to have an alert box which you can either continue or exit and show macro. When you click on exit it opens the macro that’s running to the actual step of that alert box.
I’ve found the %ExecutingMacroGroup% and %ExecutingMacro% however I can’t seem to find one for the Action Step.
My work around has been that I’ve been numbering my alert boxes but this takes extra time and when things get moved around the sequential order gets screwed and I’ve noticed a few requests for auto numbering of actions within macros which unfortunately hasn’t materialised.
Alternatively if there’s a workflow for this sort of thing that I’ve missed please let me know.
+1 for using the built-in Debugger for this -- while that is open and a macro is running, clicking on the "pencil" button will open a new Editor window on the macro with the currently executing Action selected. Plus the Debugger lets you do a whole lot more!
If you must use an "Alert" dialog, the "simplest" way is to include the Action ID in the alert text. It won't be clickable or selectable, but you could run another macro that OCRed the Alert and extracted the number. You could then use an "Open a URL" action and the KM URL scheme:
keyboardmaestro://q=action:123456789
...will find the macro containing the Action with ID 123456789 in the Editor, click on the macro and the Action will be highlighted.
Or you could use AppleScript:
tell application "Keyboard Maestro" to selectAction 123456789
...though you'll have to scroll down the Editor window to find the now-selected Action.
But if you are using an Alert box you will need to hard-code the Action ID -- as you rightly say, there's no token for this (though that is already a feature request). While you could make another macro that did "add a new Alert dialog Action and set the text to the ID of the Action", that's another layer of complexity...