File Launch triggers a KM Macro

I have a new app that I am enjoying using called Freeter. It’s great for setting up a project in one place. Not as complex as a project manager but more for just putting all the pieces of a project in one place so that I can focus on them. If you want to see more about it, go here, and here

What I cannot do yet is trigger a KM macro from within Freeter. It will allow me to launch a file but as far as I know there is no way to launch a KM macro as a saved file. AppleScript yes, KM, no.

Is there a way to do this using KM? I suppose I could save an AppleScript that triggered a macro key and link to that. But in KM, is there anyway to do this? Thinking not, but thought it would be good to ask just in case.


You can tell Freeter to run shell scripts. So, you can launch a macro with that.


osascript -e 'tell application "Keyboard Maestro Engine" to do script "408131D4-9BDD-4FE0-A7CF-A289A7D9265E"'

You find the triggering script for your macro in the "Or by Script." menu in the header of the macro:

Thanks. Great tip.

I also just discovered - sorry I missed it, that I can export a macro as a trigger file which doesn’t seem to work on a macro that launches and resizes two finder windows, but does work on a macro to launch a regular use app and move it to the correct size and correct screen.

Indeed. That file you can also launch with Freeter I guess.

BTW, the exported file just contains the Macro UUID, the same as with the shell command.

Can you upload an example macro for that?

Hmmm … not sure what happened, but it seems to be working now. Not sure why or if the file would do you any good. Ghost in the machine I guess. Works OK now.

My guess would be a timing issue, opening the file will being the Keyboard Maestro Engine to the front, then it will reset it back to the previous application, but if your macro immediately expects to still be in the original application, it’s possible that the initial action(s) might be applied to the engine instead of the target application. Add a short pause to the start of the macro.


Doesn’t Freeter allow you to create a hyperlink/URL?
If so then you can use the KM URL trigger (KM Wiki).

1 Like

I was not aware of that, thanks. Now I have three ways of doing this, the URL method you just described, Using a terminal command line, and the easiest route that I took, export the macro as a trigger then use Freeter to open a file pointed to that macro trigger file.