Automator workflow of the month: Add Spotlight comments
By Christopher Breen, Macworld
As we waltz through our digital lives, we tend to accumulate files and folders, and folders full of files. While a portion of this accumulation is the kind of effluvia that we won’t need next week, much less five years from now, for many of us a large chunk of it is data that will be as important tomorrow as it is today. Think long term business projects, financial files, and databases, for example. If you’re an organized person, you’ve created a logical file structure that allows you to locate files many years from now. If you’re not so organized, you have to search for what you want.
OS X’s Spotlight feature provides the means for doing this. Just press Command-Spacebar and enter the name of the file you seek in the resulting Spotlight field. But what happens when you can’t recall a file’s name? You could enter a search term that seeks a particular text string within the file—finances 2012, for example. But this method could turn up a large number of results, leaving you to weed through scores of files. Worse yet, you may not recall a line of text that will produce your file via Spotlight.
Thankfully, you can tag files to give your future self a leg up with such searches. Automator makes this very easy. Here’s how:
Make a simple workflow
Launch Automator (in your /Applications folder). In the template sheet that appears, choose Application. In the Library pane, select Files & Folders. In the Actions pane to the right, choose Set Spotlight Comments For Finder Items and drag the action to the workflow area. Within the action, enter a text string that will help you later locate your files—finance2012, for instance. Ensure that the Append To Existing Comments option is enabled (so that other Spotlight comments aren’t replaced) and save your workflow to the desktop.
You can now add this Spotlight comment to any file or folder on your Mac simply by dropping that item on the application workflow you just created. To check that it’s actually working, select an item that the workflow has processed, press Command-I, and take a gander at the Spotlight Comments field in the resulting Info window. Your added text should appear there. In the future when you’re looking for a file or folder that has something to do with your 2012 financial data or the Peterson project or some other hunk of data that’s important to you, simply search using the Spotlight comment you’ve appended to the file.
Make a workflow that automatically tags when you file
This method may work for some, but others may prefer to add Spotlight comments as they file their work. This too can be easily done. In such a case, creating the workflow is almost the same.
Start by creating a new folder in the Finder. It’s within this folder that you’ll store files related to a particular project or theme—that Peterson project or your 2012 financial files, for example.
Launch Automator and choose Folder Action from Automator’s template sheet. Configure the workflow exactly as you did in the previous example—using the same Set Spotlight Comments For Finder Items action. At the top of the workflow area, you’ll see Folder Action Receives Files And Folders Added To, followed by a pop-up menu that reads Choose Folder. Drag the folder you created in the Finder to this pop-up menu. The menu’s name will change to the name of the folder. Save your workflow. Now, when you place an item in this folder, the text you added in the workflow will be automatically appended to the item’s Spotlight comments.
Note that this action needn’t be the only one you attach to a folder. It could be one part of a more complex workflow. For example, the workflow might also be configured to automatically back up its contents to a folder on another hard drive or server. The beauty of this little action is that you can tag your files and folders as you’re going about larger tasks.
Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read ouraffiliate link policyfor more details.