Changes to Finder selection?

I’m wondering if there have been changes to how the Finder handles selections. I’m a bit slow in gettng to this question, I’ve got Jaguar and am only now porting some of my old OS 9 scripts to X. I’ve got a very simple script that reads:

tell application "Finder" copy "backed up on 5/4/03" to the comment of every item of the selection end tell
…and it doesn’t work, although it used to under OS 9. So I revamped it according to the best info I can find and came up with:

display dialog “Enter the comment text” default answer “Backup”
copy the text returned of the dialog reply to theText

tell application "Finder" repeat with theItem in the selection of the folder of the front window copy theText to the comment of theItem end repeat end tell
…it still doesn’t work. Can someone tell me the proper syntax for accessing Finder selections?

Nitewing '98

Model: iMac DV+
AppleScript: 1.9.1
Browser: Firefox 1.0.7
Operating System: Mac OS X (10.2.x)

That didn’t work either…AT FIRST. Then I realized that what I’ve been fighting is the fact that script menu scripts deactivate the front Finder window when they launch (don’t ask me why) and I think I was losing the selection because the window went inactive. When I saved the script as an application and tried using it from both the Finder toolbar and the Dock, it worked.

Thanks for the HELP! :cool:

Nitewing '98

See also: Set Finder/Spotlight Comments

What I needed was an “activate.” I guess because the Finder is always running it never occurred to me that I might need to activate it (DUH on my part). Adding the “activate” causes my script to function correctly from the Script Menu.

Nitewing '98

Model: iMac DV+
AppleScript: 1.9.1
Browser: Firefox 1.0.7
Operating System: Mac OS X (10.2.x)