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.
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.
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.
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.
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.)