Trigger Keyboard Maestro Macros from Spotlight search

I use Spotlight to launch pretty much everything on my mac.

I wonder if there’s a way to make it index my keyboard maestro macros and launch them through this route.

I already have a Macro “Trigger Macro by Name” attending by cmd+alt+control+T, but wish there was a way to consolidate it inside Spotlight.

I’m not aware of a straightforward method to do that via Spotlight.

I accommodate this through use of Alfred. This is easily done in Alfred along with so much more. Super app that can serve as an easy enabler to all sorts of automation on your Mac.

2 Likes

+1 for Alfred.

I have several macros where I hit Alt+Space and type “k ” where the short code is something like “sc” for “select CSV columns”. (Yes, that’s a real one.)

It was easy to set up - once I figured out how to use the editor. And I believe it’s a Pro/Premium/whatever feature. But worth it.

@Martin_Packer Could you elaborate? I would like to start a Keyboard Maestro from Alfred by entering a string of text. So what action do I need to create in Alfred and what trigger do I need to setup in Keyboard Maestro?
I’ve created multiple workflows in Alfred before, that’s no problem, but I can’t get Keyboard Maestro to work.

Here is an example that you can work from. The left half shows you the Alfred Shortcut. The right half is the corresponding Keyboard Maestro Macro.

You’ll see in the Alfred shortcut use of AppleScript to grab the value of Alfred text input (q). That value is saved in a variable that is referenced by Keyboard Maestro.

1 Like

That works! Thank you very much.

2 Likes

For Launchbar users who might stumble upon this, there is a Launchbar action that indexes your Keyboard Maestro macros, and makes them available through the normal Launchbar interface.

You might also find this useful:

1 Like

I’ve been using this workflow for Alfred on Catalina for a while now and my experience is that it works very well for launching any Keyboard Maestro macro, without having to create a specific Alfred workflow for the macro.

Just be sure to read this topic to make sure the security requirements steps are carried out.

I’ve made the switch from Spotlight to Alfred and am also using this very same extension. Many thanks to both of you, @capcrime and @sylumer

Btw, for anyone on the fence on Alfred it is so much more faster!

Can you export the KM macro as a trigger file (under the File menu), then use Spotlight to run the trigger file? I just played around with it for a few minutes, and it seems to work better if I type the name of the trigger file and start typing the .kmtrigger extension.

Would this be practical for you?

(I have a bunch of trigger files to run iTunes playlists in a folder in my Dock, so I can just open that as a grid and click on the playlist I want to hear.)

-Eric