renaming files from a spotlight window

Hi

Is there any way I can get selected files from a Spotlight window?

I am renaming image files that are scattered over a hard disk. These images would have the same name ie aaa.jpg. I search in spotlight for them and highlight the ones I need to rename. I can write the renaming script but I can’t seem to “get selected items” to start the process.

Regards

Model: 11 macs, all my babies
AppleScript: 2.1.1
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)

Hi -

It will work with Finder.

Type aaa.jpg into the Finder search field, select all aaa.jpg, then run your script starting with “get selection.”

j

Thanks capitalj,

Must have a had a serious DUH! moment.
Here is the script if it helps anyone
You must have searched in finder first and highlighted files you wish to rename.



display dialog "Enter new name" default answer 
set newname to text returned of result
tell application "Finder"
	set theList to get selection as list
	repeat with i from 1 to number of items in theList
		set this_item to item i of theList
		my changename(newname, this_item)
	end repeat
end tell

on changename(newname, targetfile)
	tell application "Finder"
		set name of targetfile to newname
	end tell
end changename

If it makes you fell any better, my DUH! moments still vastly outnumber my EUREKA! moments. Sigh.