I have 100s of files which need to have a particular spotlight comment. I can do this manually by opening the "Get Info" dialog box, but this is very time consuming. Is there a way of selecting an file (or a whole lot of files) and applying an appleScript which will automatically place the spotlight comment. ______________________________________________________________________
Hey JF,
It's better to use an alias list in the Finder than Finder-References (much faster in general).
This script will handle one or more selected files.
It works around the Finder-selection bug in Lion/ML.
Many hundreds of files will take a long time and possibly lock up the Finder for an extended period, but a few hundred at a time shouldn't prove to be much of a problem.
Testing with 256 files selected on my machine this script takes:
~ 5.5 seconds when run from Script Debugger. ~ 2.1 seconds when run from FastScripts. ~ 2.3 seconds when run from Keyboard Maestro. ~ 2.2 seconds when run from Smile. ~ 2.3 seconds when run from the Applescript Editor.
-- Best Regards, Chris
-------------------------------------------------------------------------------------------
try
set _comment to "This is your life Charlie Brown"
tell application "SystemUIServer" to activate tell application "Finder" activate set _sel to selection as alias list if _sel ≠ {} then repeat with _alias in _sel set comment of _alias to _comment end repeat end if end tell
on error e number n set e to e & return & return & "Num: " & n tell me to set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK" if button returned of dDlg = "Copy" then set the clipboard to e end try
-------------------------------------------------------------------------------------------
|