Hello All,
I’ve recently discovered an Applescript created by Tracy Valleau called CloneEject (aka StopSpotlight): http://www.tracyvalleau.com/page3/page0/page0.html
on open these_items
set x to the count of these_items
if x is 1 then
set this_item to (item 1 of these_items)
do shell script “touch "” & POSIX path of this_item & “".metadata_never_index”
delay 1
do shell script “hdiutil unmount "” & POSIX path of this_item & “"”
end if
end open
quit
This script prevents Spotlight from indexing external drives. It works like this: drag a volume onto this Applescript Application and a file is written to the drive to prevent spotlight from indexing it (.metadata_never_index), then the drive is ejected and manually re-mounted (so Spotlight sees the dot-file and doesn’t index it).
I’m wondering if it’s possible to make this a folder action (in /volumes) so when a volume is mounted it runs automatically (but also checks to see if .metadata_never_index already exists so it doesn’t run an infinite loop). I tried converting it to a script and adding as a folder action, but nothing happens when a volume is mounted (perhaps because it starts with “on open” instead of “on mount”?). I think the code would only need a small tweak, but really have no idea where to start (I’m a super applescript newbie).
Can anyone tweak this to get it working as a folder action? Or give an suggestions or other places to look?
Thanks!!!
Brian