Re: find a list item
Re: find a list item
- Subject: Re: find a list item
- From: email@hidden
- Date: Wed, 1 Apr 2009 17:26:40 +0000
- Importance: Normal
- Sensitivity: Normal
That's a fair point which concede to but OPs further actions on the list may (or may not) involve
repeat with x from 1 to (count of available)
DoSomethingWith item ( item x of available) of theListe
End repeat
Versus
repeat with aThing in available
DoSomethingWith aThing
End Repeat
It's less typing :-) that's all
Steve
------Original Message------
From: Yvan KOENIG
Sender: applescript-users-bounces+stevet=email@hidden
To: AS AppleScript Users
Sent: 1 Apr 2009 18:10
Subject: Re: find a list item
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
Sent from my BlackBerry® wireless device
_______________________________________________
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