Started working on a new AppleScript to trigger a new KM Macro. I copied the code from KM and ran it. For some reason it’s not working now. I also ran a known working script and now that’s not working either. Did something break in 10.11.6 or have I just overlooked something?
The script is enabled and it’s active.
When I run the AppleScript I am getting the all too familiar error:
“Keyboard Maestro Engine got an error: do script found no macros with a matching name.”
Well I haven’t actually even gotten into the Keyboard Maestro action but the AppleScript looks like this:
tell application "Safari"
if not running then run
-- ignoring application responses
tell application "Keyboard Maestro Engine"
do script "2F60BFBF-2134-4C2F-9CD3-391A40xxxx"
-- or: do script "Partners Statement Download"
-- or: do script "2F60BFBF-2134-4C2F-9CD3-391A40724860" with parameter "Whatever"
-- end ignoring
Yes. So is Safari at the front at the time your script runs?
I see you activate Safari in the script, but its possible Safari has not actually activated, or that Keyboard Maestro Engine has not responded to the activation and activated the macro group, at the point that the script asks for the macro to be executed.
Try running your script after manually activating Safari, does that work?
Right, so the macro group is not quite enabled yet when you try to trigger the macro.
Move the macro so it is in globally available macro group, or depending on how you are running the script, possibly you can use Keyboard Maestro’s Activate a Specific Application action to activate Safari first.
It probably does activate Safari - but the actual activation probably has not completed, and even if it has, Keyboard Maestro Engine needs a chance to recognise that it has and update the activations of the macros. If you put a delay in the script between the two, that might be enough.