MACRO: Go To Macro by Name (Spotlight)

MACRO: Go To 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.

NOTE: This supercedes Macro Spotlight

Go To Macro by Name (Spotlight) (873.0 KB)

See the enclosed README file for installation instructions.

Press Ctrl+G (or assign the trigger of your choice), type a few letters, hit Enter, and find youself editing the selected macro. It's as simple as that.

When you type into the filter box, it searches the Macro Names and the Group Names (you can turn this off if you don't like it.)

The macro's Group is displayed in the status line.


This macro works in conjunction with the "Macro Scroll Position" Sub-Macros, to save and restore each macro's vertical scroll position in the editor.

Which means it also works in conjunction with version 2.0 of the Toggle Between Macros and Maintain Scroll Position macro, which also saves and restores scroll positions.

NOTE: You can disable the Scroll Position feature easily, if you don't like it.


Hi Dan,

is there a reason for the resources folder being a .pkg bundle?

A .pkg is saying “double-click me” —at least to me—, and I did it repeatedly :wink:

I know - I keep doing that too. :smile: Fortunately, once you get it into place, you can ignore it.

There’s no specific reason, other than Atom treats it just like a folder, and that makes it really easy.

Is there another kind of bundle I should be using?

A normal folder?

No, I don’t want people messing around in it. I know that people can get into packages just as well, but this helps treat it like a single entity.

You can set the ACL for a folder and its content, for example:

chmod -R +a "everyone deny write,delete_child" <folder>

If you create the zip archive with ditto the ACL should be retained:

ditto -ck <src folder> <dest>.zip

or better: as .dmg.

Indeed, you forced me to do so :wink:: After 3 times double-clicking, then re-extracting the zip (I thought the .pkg got corrupted upon expansion), and double-clicking again I finally looked inside the “.pkg”.

But don’t worry, from now on I know how to deal with Dan’s special .pkg bundles… :wink:

Edit: Just noticed that I’m in the wrong topic. I thought I was in your other Spotlight topic.

How about this, which I something I did in at least a couple of the other macros:

When you unzip the file, you get two files:

  1. A README file, named with a leading underscore, so it sorts to the top.
  2. A file called “”.

So this should be more clear that you need to read the README first. The readme just explains what to do with the files in

Would that help?

IMO, anything is better than a fake .pkg that causes the system to show a dialog telling the user to move the damaged .pkg to the Trash :sunny:

A ReadMe on top position is what I would do, too.

If you really are afraid that people will manipulate the content, you could append something to the folder name like “— don’t touch content”.

Or an icon:

Forbidden (991.3 KB)

Ah, that explains the problems someone else was having.

Dang! I was so proud of myself! :slight_smile: I’ll work something out.

You didn’t know this?! OK, now I understand how you could even consider the .pkg thingy :wink:

‌[quote="DanThomas, post:9, topic:4666"]
I'll work something out.

Distributing it as .dmg, you can do something like this:

There are at least two good programs available that let you create nice DMGs very easily:

I prefer DropDMG because it offers a plethora of additional functionality for creating DMGs, which otherwise is only available through hdiutil. It also can do the new LZFSE compression, and in the new version you can automatically codesign your DMGs with it:

Don’t dmg’s have to be mounted?

Never mind - I see what you mean.

Are there security setting issues with these?

What do you mean with “security setting issues”?

DMGs are a very common distribution method for apps (and anything).

Sorry. I meant that I wondered if the security settings on some people’s computers would prevent them from using these files, because they’re not signed, didn’t come from the Apple Store, etc.

No issues with that?

Thanks, by the way.

You can codesign DMGs for Gatekeeper (see my post above). It seems Apple made it mandatory recently. Since it’s pretty new, I don’t know much about it. (Formerly you only had to sign the app or/and the installer.pkg.)

But since you are not distributing executables I think there is no need to code sign it at all. If there are (or will be) any code-signing problems you would have them with zip archives as well. (And, contrary to DMGs, you can not code sign zip archives, in case it’s needed.)

I’m pretty sure that Apple will not drop DMG as distribution format anywhere in the foreseeable future.

Btw, there’s also a new archive format (XIP) that can be signed.

Thanks Tom.

Just so you know, I’m a recently retired Windows developer, so although I’m obviously no rookie, I am when it comes to Apple-specific issues. So I really appreciate you helping me out here.

Here’s what I’d ultimately like to do, but I don’t know the ramifications of individual users’ Security Preference settings:

I recently created a JavaScript applet that contains all the files I need for something like this macro. You double-click the applet, and all it does is call KM and give it a “Group” action that contains my installation code, and it passes the location of the applet also.

The installation actions run, are able to access the files in the applet bundle, and from there it’s a simple task to make sure all the files get wherever they need to be.

I really want something like this for when I issues updates, so however I store the resource files, I can be sure to update them properly.

So my question to you is, is this a reasonable thing to do, and what kind of impact will people’s Security Preference settings have? Remember, these are KM users, so take that into account.

Like I said, I’ve already got a working prototype. But just because it runs on my machine doesn’t mean it will work on other people’s.

What do you think?

And again, thanks!!

As an applet it should be signed, I think. If you want, you can send/post the thing and I will try it with different Gatekeeper settings.

But, just to clarify, this is not a DMG problem. If the applet has to be signed it has to be signed as well when it comes as zip archive.


I forgot to mention another useful thing of the DMG distribution format:

you can add your ReadMe in the place of a license text. That means, when the user opens the DMG the very first thing he will see is the ReadMe, for example like this:

As you see, you can even use Rich Text here :slight_smile:

You can also put a longer text in here, since the user can save it as RTF or print to PDF or paper.

(Unfortunately is doesn’t seem to support images. Probably to avoid the same file size problem that becomes apparent in KM’s RTF fields.)

Tom, I so appreciate your help.

I just signed up for and got my Developer’s ID, so I can codesign now. After I work through my plans, I’ll hit you up and ask you to help test my applet, and the reasonableness of what I’m trying to do.

Thanks again.

You’re welcome!

Sorry for the necro bump but while setting up a new mac I just noticed:

if edit mode is disabled and the macro is too short to have a scroll bar the Go to Macro by Name (Spotlight) macro fails with the following error:

interestingly, if edit mode is disabled and the macro is long enough to have a scroll bar, it will take you to the chose macro with edit mode enabled

and ofc if edit mode is enabled and the macro is too short to have a scroll bar, it works as expected.

I know none of us spend much time with edit mode disabled but it is the default state for a clean install of KM so I thought I'd mention it.

Correct me if I'm wrong, but doesn't KM do this for us automatically now? I think it does, and I think we don't need this macro anymore. Like I said, let me know if I'm wrong.