Re: Choose from list
Re: Choose from list
- Subject: Re: Choose from list
- From: Stephen Swift <email@hidden>
- Date: Sun, 05 May 2002 22:45:14 -0400
At 5/5/02 8:38 PM, Paul Berkowitz (email@hidden) Wrote:
>
set theList to {"Dialog Box 1", "Dialog Box 2", "Dialog Box 3", "Dialog Box
>
4"}
>
>
set optionList to {"Good Morning", "Good Afternoon", "Good Evening", "Good
>
Night"}
>
>
set theDialog to (choose from list theList) as string
>
>
set x to my UniqueIndex(theList, theDialog)
>
>
display dialog (item x of optionList)
>
>
on UniqueIndex(aList, anItem)
>
repeat with i from 1 to (count aList)
>
if anItem = item i of aList then
>
return i
>
end if
>
end repeat
>
end UniqueIndex
Thanks Paul. Much more elegant. I presume that there is no other option to
get what item number a certain value is in a list besides a repeat loop.
That would make the script even better - but I guess I'm just dreaming. :-)
Stephen Swift
email@hidden
-----------------------------------------------
AppleScript Guru - The Mac Observer
http://www.macobserver.com/tips/applescript
_______________________________________________
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.