Spotlight Comment Plugin Action Collection


Spotlight Comments Plugin Action Collection


by Ian Kirkland



Description

Tags may very well be alive and kicking in OS X. But when it comes to hunting down items in Finder, Spotlight Comments have, by no means, lost any of their moxie. In fact, it’s precisely their forgiving, format-agnostic approach to metadata that make them so useful.

With Spotlight Comments you can implement a sort of ‘custom attribute system’, fine-tune your Spotlight searches and Smart Folders by including keywords (much like we did in the pre-tag era), and even use them for the most obvious reasons: including information about a file with the file without being required to put it inside the file. It’s pretty amazing when you think about it.

The less amazing part is actually using Spotlight Comments. I can’t think of a clunkier way to interact with files than having to manually enter text via the Finder information panel — especially when you’re dealing with multiple items. If you’re not in the mood to fiddle with Automator or other more limited workarounds – or if you’re ready to unlock the potential of bringing Keyboard Maestro clipboards, variables, and built-in functions to Spotlight – then get this set of plugin actions now and put your metadata to work.



Actions

Below, you can read about each of the different actions included in the collection as well as download them individually. You can also download the entire set of plugin actions (with this documentation) here:

Download Full Collection:  Spotlight Comments Plugin Action Collection (379.6 KB)


Get Spotlight Comments

This action gets the combined Spotlight Comments of 1 or more selected Finder items and allows you to place it on the clipboard (see also: the simpler “Copy Spotlight Comments” action), save it to variable, display it briefly or in a window, or insert the result by typing or pasting it.


Download Action:  Get Spotlight Comments (28.4 KB)


Add Spotlight Comments

The “Add Spotlight Comments” action enables you to add pre-defined text and Keyboard Maestro tokens to multiple Finder items, making this action the most versatile and extensible way to add Spotlight Comments. This is where you can really take your metadata to a whole new level by getting creative with Keyboard Maestro’s incredible set of functions and other built-in tokens.


Download Action:  Add Spotlight Comments (35.4 KB)


Quick Add Spotlight Comments

This action allows you to add comments to multiple Finder items on the fly using a popup dialog. The dialog’s text field also processes any Keyboard Maestro tokens you decide to throw at it, so go wild. Note that, by default, the dialog will give you the choice of replacing or appending to the existing Spotlight Comments. If you know you will always be appending and don’t feel like choosing between 3 buttons all the time, simply uncheck the “include replace option” checkbox. The prompt will then include a more basic “OK” and “Cancel” and the action will always append new comments.


Download Action:  Quick Add Spotlight Comments (35.4 KB)


Remove Spotlight Comments

This action does exactly what it says: it removes the Spotlight comments from all of the selected Finder items. If you are prone to accidental deletions and other ‘oopses’, the action comes with a “Require confirmation” feature that, if checked, will ask for your approval when the action is run.


Download Action:  Remove Spotlight Comments (29.6 KB)


Names to Spotlight Comments

I frequently work with multiple versions of source files that have conflicting, outdated, or non-semantic names. Cryptically-named files like “DSC_9881” and 9d60ef29bc96d23cf87b92ddc9aff081.jpg“ can become a pain to deal with. Renaming these files creates additional problems when you need to access their original names. This is why I created this plugin action. It allows me to select multiple Finder items and add each item’s existing name to its Spotlight Comment field, thus leaving me with the ability to search for a given file by its new or old name. ”Names to Spotlight Comments" also comes with a couple options. The first, like several other plugin actions in the Spotlight Comment Collection, lets you choose whether to add to or overwrite existing comments. The second option allows you to toggle between the default mode (where each item name goes in its own comment) and the alternate mode (where the entire list of selected item names is applied to each item’s Spotlight Comments).


Download Action:  Names to Spotlight Comments (33.3 KB)


Copy Spotlight Comments

The Copy Spotlight Comments action, like it siblings “Cut Spotlight Comments” and “Paste Spotlight Comments”, is designed to be as simple as its name sounds: the Spotlight Comments of every selected Finder item are copied as a single, concatenated, comma-separated list and placed on the clipboard as text.


Download Action:  Copy Spotlight Comments (29.5 KB)


Cut Spotlight Comments

The Spotlight Comments of every selected Finder item are cut as a single, concatenated, comma-separated list and placed on the clipboard as text.


Download Action:  Cut Spotlight Comments (30.6 KB)


Paste Spotlight Comments

The current clipboard is pasted to the Spotlight Comments of all selected Finder items and gives you the choice of appending to or replacing existing comments.


Download Action:  Paste Spotlight Comments (31.5 KB)



Additional Notes

  • A comma, followed by a single space [“, ”] is used to separate existing comments and appended comments. The actions will detect whether such a separator exists or not and will adapt accordingly.
  • Please report any bugs at: ianthekirkland@me.com



Legal


THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

6 Likes

Is anyone using these in Mojave? Haven't tested all of them yet. Most of the ones I have tried are working, but the Quick Add action is not. Easy enough to roll-my-own using the regular Add action, which does work, I suppose.

A bit late but just found this myself. The Action.scpt for 3 or 4 of the actions refer to icons under 'Macintosh HD'...... My hard drive is called 'Mac HD' so the script fails. :frowning:

There should have been something like:
set theFilePath to POSIX file "/"
set theFilePath to theFilePath as alias

in there to get the name of the hard drive. I just changed Macintosh to Mac and that worked.

Apologies. I'll be first to admit:

  • It's been awhile since I've worked on these.
  • The actions weren't bullet-proofed well for variances in things like hard drive name (shame on me).
  • Mojave kinda came in like a "big kid knocking over the little kids' Lego castles", particularly with things involving AppleScript. These actions need my TLC.

Thank you for pointing out any issues! I'll post any updated actions. Many props to @peternlewis for his commitment to keeping Keyboard Maestro incredible and current amidst an ever-changing macOS automation landscape!

Are there any updates to these? When I download them, the actions don't seem to be in a format that I can import them into KM. What am I doing wrong?

Hi @yashodhankhare - these are Third Party Plugin actions; you install them by dragging the downloaded zip file onto the KM icon in the dock on your Mac.

For a full explanation, see the KM wiki manual page here:
https://wiki.keyboardmaestro.com/manual/Plug_In_Actions?s[]=plugin

Hope that helps!

Many thanks for your prompt reply. I tried to follow the link you sent, But, I am an end-user with ZERO coding or related skills. This is what I want,

I want to add keywords in the comments field of files that I have selected in the finder. Any easy way of doing this?

Yes - that's the thread we're in right now...

Your OP said

So I was just telling you how to install them into KM. The link I pointed you to also has a section entitled How to Install. I don't know anything about actually using the plugin actions themselves, so - once you've installed them, you can use them by following the documentation given by the author in the first post of this thread.

If you are really that new to KM you need to follow the tutorial information provided within KM itself and also the getting started advice given in the first thread in the forum

1 Like

Thanks. That is helpful. I’m not new, just a bit confused. But, I appreciate the help.

1 Like