Re: simple problem?
Re: simple problem?
- Subject: Re: simple problem?
- From: Christopher Nebel <email@hidden>
- Date: Wed, 21 Nov 2007 16:58:50 -0800
On Nov 20, 2007, at 12:00 AM, Richard Morton wrote:
On 20/11/2007, at 6:23 PM, Skeeve wrote:
Richard Morton wrote:
set group to ( choose from list {"Group A", "Group B", "Group C",
"Group D", "Group E", "Group F"} with prompt "Please select the
group letter you have been assigned:" ) as string
This is correct and I think a good solution.
This is correct by accident and a not-so-good solution.
Not at all.
Actually, I agree with Skeeve. The difficulty with "as string" is
that, while it works for this case, and that's not an accident, it's
not really saying what you mean. This leads to conceptual
difficulties with how lists work and non-functioning code later on.
For instance, say you want to be able to have more than one group in
effect. You might find the "with multiple selections allowed"
parameter -- and then the "if" tests, as currently written, wouldn't
work. You might also note the difficulty with using "display dialog"
as your only debugging tool -- because it coerces its argument to
text, it can obscure differences in what values are. (This isn't a
'class' mismatch, it's just that the values aren't the same: x is not
the same thing as {x}.)
To sum up: saying 'item 1 of (choose from list ...)' means you
understand that you're dealing with a list. However, an even better
solution would be to use "contains" instead of "is" for the tests:
you're then not assuming that your list contains exactly one item.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden