Re: how to use data from choose from list
Re: how to use data from choose from list
- Subject: Re: how to use data from choose from list
- From: JJ <email@hidden>
- Date: Mon, 08 Jul 2002 19:21:45 +0200
>
This has got to be a no-brainer for someone one this list - - - can someone
>
tell me what I'm doing wrong in my "if" statement. I just want to be able
>
to branch, based on the results of the user clicking in a list. Right now,
>
selecting Apple does nothing.
>
>
>
set theList to {"Apple", "Orange", "Grape"}
>
>
set userChoice to choose from list theList
>
>
display dialog "userChoice = " & userChoice
>
>
if userChoice is "Apple" then
>
display dialog "Apple was selected."
>
end if
The result of "choose from list" is a _list_ of strings (one, or more if
allowed). So:
if userChoice is {"Apple"} then
display dialog "Apple was selected."
end if
When you
display dialog "userChoice = " & userChoice
userChoice is automatically coerced to string, then if you choose "Apple",
{"Apple"} is coerced to "Apple".
JJ
_______________________________________________
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.