Re: Extract item from a list
Re: Extract item from a list
- Subject: Re: Extract item from a list
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 22 Mar 2010 09:43:07 -0400
On Mon, Mar 22, 2010 at 9:31 AM, Dr. Barbara Mueller <email@hidden> wrote:
>> Like this?
>>
>> set myList to {"floating window", "dialog", "standard window"}
>> tell myList to set its item 2 to "dialog window"
>> myList
>>
> Thank you for your immediate answer!
> This solves my problem at least partially.
>
> But how can I give the item "dialog" a different name if it is not always
> item 2?
> I would like to change the item "dialog" regardless of its position in the
> list.
So you want to search the list for a specific item and change it if
present. I believe that requires a loop. Here's an example:
set myList to {"floating window", "dialog", "standard window"}
tell myList
repeat with i from 1 to count
if item i is "dialog" then
set item i to "dialog window"
end if
end repeat
end tell
myList
--
Mark J. Reed <email@hidden>
_______________________________________________
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