Pass value and invoke KM from Alfred

I have an Alfred workflow with produces a string that is the result of an Alfred search. From within that Alfred workflow I would like to invoke a KM macro that acts on that string.

One workaround is to run the Alfred workflow, put the string in the clipboard, and then separately run the macro.

I have the iansinnott/alfred-maestro workflow installed, which may be helpful, but connecting to it from Alfred's "Copy to Clipboard" action yields the string being passed into the Alfred interface. I'm happy to find a way to use that workflow or some other approach.

It seems having an Alfred workflow example that invokes a specific KM macro would benefit the communities that use both, as there are so many ways to use this. But I haven't been able to find such an example.

Any advice? Thanks!

You could use AppleScript to do this.

Indeed, this works great:

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

Thank you!

Hmmm, didn't paste properly. I meant:

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

where PasteBook is the name of a KM.

1 Like