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: Michelle Steiner <email@hidden>
- Date: Mon, 16 May 2005 12:02:58 -0700
On May 16, 2005, at 11:24 AM, Patrik B. wrote:
Can anybody tell me how I get the number of an item I picked in a list
unless I can delete the item directly from a list without needing the
position parameter.
Brute force method; it works well for small lists:
set a to {"Hi", "bye", "good morning", "Tschau", "Hello world"}
set b to item 1 of (choose from list a)
set c to {}
repeat with i from 1 to count of a
if item i of a is not b then copy item i of a to end of c
end repeat
c
Here's another method; it presumes that "•••" does not appear
anywhere in the list:
set a to {"Hi", "bye", "good morning", "Tschau", "Hello world"}
set b to item 1 of (choose from list a)
if b is item 1 of a then
set e to rest of a
else if b is last item of a then
set e to items 1 through -2 of a
else
set text item delimiters to "•••"
set c to a as text
set begin_char to offset of b in c
set end_char to begin_char + (length of b) + 3
set d to text 1 through (begin_char - 1) of c & text end_char
through end of c
set e to text items of d
end if
e
-- Michelle
--
We're not human beings having a spiritual experience.
We're spiritual beings having a human experience.
_______________________________________________
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