Re: Choose from list
Re: Choose from list
- Subject: Re: Choose from list
- From: Matthew Stuckwisch <email@hidden>
- Date: Sun, 5 May 2002 21:57:07 -0500
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. :
-)
Hmmm....does anyone know if it's possible to get offsets in terms of
paragraphs, instead of characters? If that's possible you could convert
the list into a return delimited string and then find the offset of the
chosen item.
Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa / G}(esperNET / irc.massinova.com)
_______________________________________________
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.