Re: How to get parameter item of a string in a list
Re: How to get parameter item of a string in a list
- Subject: Re: How to get parameter item of a string in a list
- From: "Gary (Lists)" <email@hidden>
- Date: Mon, 16 May 2005 14:39:06 -0400
"Patrik B." wrote:
> Hi,
>
> I have a list of strings
> (lets say five, "Hi", "bye", "good morning", "Tschau", "Hello world") and I
> want the number of the item I selected (lets say I selected item "good
> morning") In my example it would be 3. How do I get this number so that I
> can pass it to a variable so that I can delete it from a list using a
> removeItem handler. etc.?
set myList to {"hi", "bye", "allo", "au revoir"}
set phrase to choose from list myList -- returns a list, eg. {"allo"}
set phrase to item 1 of phrase -- a string "allo"
repeat with i from 1 to (count myList)
if item i of myList is phrase then return i
end repeat
--> 3
--
Gary
_______________________________________________
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