Re: Choose from list
Re: Choose from list
- Subject: Re: Choose from list
- From: Christopher Nebel <email@hidden>
- Date: Tue, 19 Jul 2005 16:21:27 -0700
On Jul 19, 2005, at 12:41 PM, Robert Poland wrote:
set theList to {"Lying", "Sitting", "Standing", "All"}
set theChoice to {}
set theChoice to (choose from list theList default items {"All"}
with prompt "Select Blood Pressure(s) to Plot." with multiple
selections allowed) as string
set m to {}
set n to 0
repeat with i from 1 to number of items in theList
set x to item i of theList
set n to n + 1
if x is in theChoice then copy n to end of m
end repeat
m
The way you're processing the result into a list of indices is a bit
odd. It works (at least here), but involves an unnecessary variable
in the loop, and the coercion to string wastes time and will cause
trouble if you ever have an item that is a substring of another.
(Try adding an extra item "Falling" and then pick only "Falling" to
see what I mean.) Consider this instead:
set theList to {"Lying", "Sitting", "Standing", "All"}
set theChoice to (choose from list theList default items {"All"} with
prompt "Select Blood Pressure(s) to Plot." with multiple selections
allowed)
set m to {}
repeat with i from 1 to number of items in theList
if item i of theList is in theChoice then copy i to end of m
end repeat
m
--Chris Nebel
AppleScript and Automator Engineering
P.S.: Seeing as how multiple selection is allowed, isn't "All" as a
separate choice sort of redundant? Try saying "choose from list
theList default items theList"...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden