AppleScript Spotlight trigger

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

Apple’s AppleScript product manager, Sal Soghoian, was kind enough to get in touch to offer up this cool little AppleScript that acts as an instant Spotlight search trigger. It goes like this:

Launch Script Editor (/Applications/AppleScript/Script Editor) and enter this text into a new Script Editor window:

set this_appfile to path to me tell application "Finder" set the search_string to comment of this_appfile end tell tell application "System Events" keystroke " " using {option down, command down} delay 1 keystroke search_string end tell

Save the script as an application. In the Finder select the saved application you just created and press Command-I to bring up the Info window. Click the triangle next to Comments and enter a comment along these lines: “date:today kind:image ” (without the quotes but with the space after image so you can easily expand the search by adding other data).

Drop the AppleScript application into the Dock and click on it whenever you want Spotlight to quickly find any images mucked with today. Feel free to experiment with copies of the script by entering other values into the Comments field to trigger different kinds of searches—“kind:music Rosie Thomas ” or “date:This Month Denmark ” for example.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon