• 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: find a list item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find a list item


  • Subject: Re: find a list item
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 1 Apr 2009 19:10:35 +0200


Le 1 avr. 2009 à 18:17, Steve Thompson a écrit :


On 1 Apr 2009, at 16:34, Yvan KOENIG wrote:


Le 1 avr. 2009 à 17:03, Ronald Hofmann a écrit :

Hi,
I have a list with a few items and I want to find all items with "iso"
My attempts do not work.


Any clues?

set theListe to {"Iso", "not", "Iso", "not", "Iso"}
get items in theListe where it contains "iso"

set theListe to {"Iso", "not", "Isocele", "not", "Isotope"} set available to {} repeat with i from 1 to count of theListe if item i of theListe contains "Iso" then copy i to end of available end repeat available

Will return {1,3,5}. You need either

set theListe to {"Iso", "not", "Isocele", "not", "Isotope"}
set available to {}
repeat with anItem in theListe
if anItem contains "Iso" then copy anItem as string to end of available
end repeat


or

set theListe to {"Iso", "not", "Isocele", "not", "Isotope"}
set available to {}
repeat with i from 1 to count of theListe
if item i of theListe contains "Iso" then copy item i of theListe to end of available
end repeat


Steve

Given the original question, I was not sure if the OP wished to get the values of the items or their index in the original list.


I choose to return the index.

Only the OP knows what he really wanted.

Yvan KOENIG (from FRANCE mercredi 1 avril 2009 19:10:33) _______________________________________________
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
References: 
 >Re: Moving large PDF files with Applescript (From: "John C. Welch" <email@hidden>)
 >find a list item (From: Ronald Hofmann <email@hidden>)
 >Re: find a list item (From: Yvan KOENIG <email@hidden>)
 >Re: find a list item (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: Moving large PDF files with Applescript
  • Next by Date: Re: Moving large PDF files with Applescript
  • Previous by thread: Re: find a list item
  • Next by thread: Re: Moving large PDF files with Applescript
  • Index(es):
    • Date
    • Thread