Re: Choose from list
Re: Choose from list
- Subject: Re: Choose from list
- From: Carlos Ysunza <email@hidden>
- Date: Mon, 17 Oct 2005 13:36:23 -0500
Paul this is a very nice solution...
But I would like to ask you, about your last comment
>I use a version incorporating a "Serge" script object to go faster when the
> list is large (100 items or more).
I don't have idea what you talking about when you say "Serge" but sounds
like I'm missing something important, because I have some scripts that deals
with large lists of objects and of course will be very important to make my
process much faster.
Could you tell us something about it...
Thanks
Carlos Ysunza B.
Director
Ysunza/Santiago
Visual Communication Automation
Tel. (52)55 5256-0336
email@hidden
http://www.ysunzasantiago.com
http://www.thesecretmexico.com
http://www.applescript.com.mx
> From: Paul Berkowitz <email@hidden>
> Reply-To: <email@hidden>
> Date: Sun, 16 Oct 2005 08:29:16 -0700
> To: AppleScript-Users <email@hidden>
> Subject: Re: Choose from list
>
> On 10/16/05 7:44 AM, "Robert Poland" <email@hidden> wrote:
>
>> I have this line in a script;
>>
>> set theChoice to (choose from list theList default items
>> theDefaultList with prompt "Select Calendar")
>>
>> I know how to get the text returned, but I would like to get the
>> number of the item chosen.
>>
>> Page 337 of Matt's book doesn't even address this situation.
>>
>> Where else can I go to find this answer?
>
> Here's the right place. It's a good question. AppleScript does not provide a
> built-in answer. There are probably some osaxen (Satimage?) that do it - in
> Classic days Akua Sweets had one. I use a handler:
>
> set theChoice to (choose from list theList default items
> theDefaultList with prompt "Select Calendar") as Unicode text
> if theChoice = "false" then error number -128 -- cancel
> set listIndex to my CollectUniqueItemIndex(theList, theChoice)
>
>
> to CollectUniqueItemIndex(theList, theItem) -- the Item can be string,
> number, constant, app object or list
>
> local aListMember
>
> set theIndex to 0
> repeat with i from 1 to (count theList)
> set aListMember to item i of theList
> if aListMember = theItem then
> set theIndex to i
> exit repeat
> end if
> end repeat
>
> return theIndex
>
> end CollectUniqueItemIndex
>
>
>
> I use a version incorporating a "Serge" script object to go faster when the
> list is large (100 items or more).
>
>
>
> --
> Paul Berkowitz
>
>
>
_______________________________________________
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