Applescript Trigger by Name or UUID Produces Error

I am not that good with KM - you have been warned :slight_smile:

Experimenting with Hazel and Applescript to run a macro based on the name or UUID. When run I get an error (see below). I used the 'Copy As' menu function to obtain the UUID, and the macro name was copied from the title of the macro.

That's where I'm at... seems as though it should work?

-- ignoring application responses
tell application "Keyboard Maestro Engine"
	do script "Save Attachments of Selected Message v1.10"
	-- or: do script "F03C712A-D330-42A9-BF6E-2A7998B199F4"
end tell
-- end ignoring


Just tested it with an arbitrary macro (from Script Editor, I don't have Hazel) and it works fine, by name or ID.

the macro name was copied from the title of the macro

You can copy the whole launcher script (including name and ID) from the Script trigger:

1 Like

I just copied the whole launcher, ran it in the script editor... with the same error:


Weird. Have you tried relaunching KM Engine? Maybe it has messed up the registered macro names or something…

You can quit and launch KM Engine from the KM Editor menu (File > Quit Engine | Launch Engine).

You need to pay attention to the error message. Make sure:

  • the macro is enabled
  • the group the macro is in is enabled and active

Have a look at this discussion for the same problem.

1 Like

I did take a look at that thread - - thanks. However, both the group and the macro are active.

Just discovered what my problem was! I had the macro set to be available in the mail application ONLY. So, of course the script editor could not run something it did not have access to.

Thanks for the assist!

1 Like

Well that's just another way of saying while you were testing in script editor your mail macro group was not active and so no macros in that group would be able to execute.