Can You Trigger a Macro Using a File on the Desktop?

My apologies if this has been covered or if it's an easy thing, but is there a way to trigger a macro from a desktop icon/file? Thanks —Bob

Just create an AppleScript to fire off the macro and save it as an applet/application.

tell application "Keyboard Maestro Engine"
    do script "[Name of Your Macro]"
end tell
1 Like

Thank you!

OK, some weirdness: My KM hot key trigger works perfectly, but when I create an AppleScript using the above script, it doesn’t work. I’ve verified the correct KM name of the macro. Any ideas?

You inspired me, @h0rseman. Here's an AppleScript to build the applet for you. Select one or more macros, run the script, and you'll have a double-clickable doodad on your desktop.

My guess as to why yours wasn't working is that the script wasn't enabled for some reason -- application specific group, maybe? Just a guess.

Wow, too cool, iNik! It’s late now, but I’ll try it out over the weekend and get back to you. Thank you!

Hi, I was looking for a tip to launch a KM macro from an AppleScript application.
I created this little application by following this topic (thanks @iNik):

tell application "Keyboard Maestro Engine"
do script "myScript"
end tell

This script works, but with a very long processing time, very long (more than 10 seconds).
I registered it as Application, with only the executable.

Is there another more effective solution? Thank you for your attention ...: wink:

...

Bonjour, je cherchais une astuce pour lancer une macro KM depuis une application AppleScript.
J'ai créé cette petite application en suivant ce topic (merci @iNik) :

tell application "Keyboard Maestro Engine"
do script "myScript"
end tell

Ce script fonctionne, mais avec un temps de traitement très, très long (plus de 10 secondes).
Je l'ai enregistré comme Application, avec uniquement l'exécutable.

Existe-t-il une autre solution plus efficace ? Merci pour votre attention... :wink:

There should not be an appreciable delay. Not more than a fraction of a second.

Something else is going on with the AppleScript system on your Mac.

To answer the original question, you don't need AppleScript at all -- just create a Trigger File trigger.

Then just double-click, or open, that file.

image

3 Likes

Whaou! ... Thank you very much @JMichaelTX

The icon generated in the Finder has a white line on its right side: nothing very dramatic ...

image

Thank you again for your help... :wink:

NB: the .icns resource has this white line (Keyboard Maestro 8.2.4):

image