• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get parameter item of a string in a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to get parameter item of a string in a list
      • From: Emmanuel <email@hidden>
References: 
 >How to get parameter item of a string in a list (From: "Patrik B." <email@hidden>)

  • Prev by Date: How to get parameter item of a string in a list
  • Next by Date: Re: How to get parameter item of a string in a list
  • Previous by thread: How to get parameter item of a string in a list
  • Next by thread: Re: How to get parameter item of a string in a list
  • Index(es):
    • Date
    • Thread