Skip to content

Instantly share code, notes, and snippets.

@matthewmccullough
Created January 25, 2010 16:26
Show Gist options
  • Save matthewmccullough/285988 to your computer and use it in GitHub Desktop.
Save matthewmccullough/285988 to your computer and use it in GitHub Desktop.
Reapply spotlight comments to files
--Source: http://www.macosxhints.com/dlfiles/spotlight_comment_script.txt
-- you can change the text within quotes to suit your purposes....
property flag : "MySpotlightComment"
property delim : " - "
on adding folder items to this_folder after receiving these_items
tell application "Finder"
set folder_name to name of this_folder
repeat with this_item in these_items
set item_name to (get displayed name of this_item)
if item_name is not ".DS_Store" then
set current_com to (get comment of this_item)
if current_com does not contain flag then
if current_com is "" then
set comment of this_item to flag
else
set comment of this_item to (current_com & delim & flag) as string
end if
end if
display dialog "The item \"" & item_name & "\" in folder \"" & folder_name & "\" has been flagged." buttons {"OK"} default button 1 giving up after 5
end if
end repeat
end tell
end adding folder items to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment