MACRO: Execute (Trigger) Macro by Name (Spotlight)

MACRO: Execute Macro by Name (Spotlight)

==NOTE: Do not double-click the package file "Spotlight Search Prompt Resources.pkg"==
It won't hurt anything, but you'll get a very misleading error message. The error message will tell you that the file is corrupted. It's not corrupted. I shouldn't have used a package file to store resources. It doesn't hurt, but it's obviously confusing.

Please just move the package file somewhere, usually in your Documents folder or a subfolder. Then leave it as is. DO NOT DELETE IT.

It's clear that I made a poor decision to store resources in a package file. I'll work something out for future releases.

Requires OS/X Yosemite or later.

UPDATE 2017-01-10 version 1.2a:

v1.2a - Fixed bug when multiple triggers.
v1.2 - Now shows shortcut keys in the Status Line.
v1.1 - Removed options to save and restore editor scroll position, as KM 7.3 does this natively.

If you've aready installed this, or if you have already Spotlight Search Prompt installed, you only need to import the macro "Execute Macro by Name (Spotlight).v1.2.kmmacros". You'll probably want to delete the old version first, but it's not required.

Execute Macro by Name (Spotlight) (876.0 KB)

See the enclosed README file for installation instructions.

Built on top of the powerful Spotlight Search Prompt, this macro provides a list of macros, lets you select the one you want, and then executes the selected macro.

The list of macros can either be all active and enabled macros, or it can be a list you provide, either hard-coded or through some process of your own.

You can duplicate the macro multiple times, so you can have a version that shows one set of macros, a different version that shows another set of macros, etc.

You can optionally include an Edit button, which will take you right to the selected macro in the KM Editor.

Let's start a discussion below, to talk about the various ways this can be used. I've seen many people make requests that could be handled really well by using this macro.


This is pretty neat. I use this to execute macros globally and I really like it although it does have the dependency of Alfred to it.

Thank you for sharing these. Looking forward to ‘goto macro group’ one. :smiley:

Pretty cool. Let me know what you like about it, and I'll see if any of it makes sense to try and incorporate into this.

One of my future plans for the Spotlight Search Prompt is to support styling the items in the listbox, and Alfred has some cool looks to it.

Creating a "Go To Macro Group" would be pretty easy. I'll see what I can do.

1 Like

Yeah the speed of the alfred prompt is much faster than your html window and I like my simple theme for it :

Overall, I would much prefer to have your window html prompts be ported to Alfred if possible as it is much simpler and nicer interface in my opinion. Do you use Alfred yourself, I am curious? :slight_smile:

1 Like

I'll have to look into that. It's not the HTML that's slow - it's the method I'm using to get the macros. On my machine is plenty fast, but I think there's a better KM function I can be calling to get the macros.

No, I don't use Alfred.

The speed on my system is fast enough. I suspect you’re just used to Alfred. :slight_smile:

Yeah it is fast. You are right. The design of the html window and the way entries are highlighted is 10/10 work though. Thank you a lot for it.

Thanks! I worked really hard to get it right.

I still don't think the arrow keys work exactly as I'd like them to, but they're close. I also wish the highlighted item in the listbox stayed that color of blue even when the listbox isn't focused, but so far, that's escaped me. Something about Bootstrap is affecting that.

Also, I'm not 100% sure the search algorithm is exactly right, but I figured people could chime in if it doesn't work like they want. I mean, it works just fine, but whether it's perfect or not is up for debate.

Dan, I just got around to installing this macro, but I am confused.

All of the confusion is probably my doing.

Here is what I don't understand:

In your earlier Macro, MACRO: Macro Spotlight - DEPRECATED, it worked as I expected:
When I type:
it found the macros that contain that string in the name.

But your new Execute Macro by Name does NOT:

Is there something I need to configure in "Execute Macro by Name" to make it include strings that start with "@"?


Should work just fine with “@”. Are you sure the macro is enabled/active?

Bingo! Made newbie error! :blush:

Your macro got installed in the "KM" group by default, which, of course, means it is NOT active with Finder frontmost.

Thanks for the very quick response to wake me up.

1 Like

This great macro works very well with the text tags searching technique.
TIP: Searching for Macros to Run or Edit

BTW, I now have all of Dan's macros I have installed in my KM system tagged with the following:


This allows me to find all of his macros with a quick search using the KM Editor Search box.

1 Like

###New Version 1.2


v1.2 - Now shows shortcut keys in the Status Line.

v1.1 - Removed options to save and restore editor scroll position, as KM 7.3 does this natively.


Many thanks for this very quick update! :thumbsup:

Two minor glitches:
(nothing urgent)

  1. Extra character ("|") at end of hotkey

  2. Window does not appear on my active monitor, or near the active app. It always appear at the same location.

  • Can I change this to either be centered around the center of the frontmost window, or centered around the current mouse location?
  • If you can just point me to the macro/action/script that displays the window, I can made the mods.

What are the triggers for that macro?

Can I change this to either be centered around the center of the frontmost window, or centered around the current mouse location?

Actually, you can do this fairly easily. Just change the variable "DND__sspWindowPosition" to the "x, y" coordinates you want the window to display at, before executing the macro.

NOTE: While I was playing with this, the first few times the Spotlight window seemed to ignore the values in "DND__sspWindowPosition", then suddenly they started working. It's possible I have a bug somewhere.

So if this happens to you, mess around a little by opening the dialog and running something, until it starts working. I have no idea what's going on. :rolling_eyes:

Hotkey: I

OK, thanks. That's easy to do.

Fixed in version 1.2a, just uploaded.

Oh, and that issue where I thought it was ignoring "DND__sspWindowPosition"? It wasn't. I was executing the wrong macro. LOL.

Dan, this doesn't seem to be working.
When I do a KM full search for "DND__sspWindowPosition" it finds only the Action I have added to your macro with that variable.

When I look at the "Spotlight Search Prompt v1.0" macro, I don't see the window position being set anywhere.

It just hit me that maybe I have an old version of "Spotlight Search Prompt".
I'll go check now.

It’s referenced in the HTML file in the Spotlight Resources folder.