Re: Script to Get Finder Selection?
Re: Script to Get Finder Selection?
- Subject: Re: Script to Get Finder Selection?
- From: Matthew Smith <email@hidden>
- Date: Fri, 01 Aug 2003 14:12:11 +1000
on 01/08/2003 13:35, Jonathan Levi, M.D. at email@hidden wrote:
>
I'm trying to write an AppleScript that utilizes the Finder front
>
window's selected item(s). For a selection of 1 item,
>
>
get selection of application "Finder" as Unicode text
>
>
works, but I haven't found any ready way to get a selection
>
containing multiple items. It looks like I can save this selection,
>
write it out to a text file, and process the resulting file, but this
>
will involve handling lots of binary gobbledygook: can anybody
>
suggest a more straightforward way to access the selection?
The Finder's selection is a list of objects. You need to move through the
list to get each item.
tell application "Finder"
set selList to selection
repeat with oneItem in selList
-- now do something with the each item, ie oneItem.
end repeat
end tell
One thing to note, is to set a variable to what is the selection, otherwise
it is possible for the user to change the selection while your script is
processing. This way, the items will be what the selection was at the
beginning of the script.
--
Matthew
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.