Use an AppleScript to manage Spotlight indexing

Nov 04, '10 07:30:00AM

Contributed by: llee

I wrote an AppleScript droplet to manage the settings of Spotlight indexing for a volume. It's called Refocus, and may be downloaded from here.

To use it, drop a volume icon on the Refocus application icon and you'll be prompted to enter your password. After entering the password, if the dropped volume's Spotlight indexing is turned on, you'll be prompted to either turn it off, rebuild it, or cancel. If the dropped volume's indexing was turned off when dropped, you'll be prompted to turn it on or cancel. If you run the script without dropping anything, the operation will be performed on your startup disk. You'll then be asked to confirm that the full path of the disk that will be re-indexed is the disk you dropped. That path will be a Unix style path such as '/' for your startup disk or '/Volumes/archives/' for a disk named 'archives.' The script won't do anything if the disk you dropped appears in the Privacy area of the Spotlight System Preference pane.

If you want to create a version of the Refocus droplet that doesn't require you to enter your password each time you drop a volume icon, run the included 'Create Refocus with Authentication' script. If your password changes, you'll have to create the droplet again, of course.

Usage suggestion: Keep Refocus in your Dock. If indexing begins after a volume is mounted and you know you don't want it indexed, drop it on Refocus to quickly and permanently stop indexing for that volume.

[crarko adds: I haven't tested this one. The downloaded disk image has both the droplet (which can be opened in AppleScript Editor to view the source and the source to the modified script that saves the password.]

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20101104033203722