Re: Getting record items of a sublist
Re: Getting record items of a sublist
- Subject: Re: Getting record items of a sublist
- From: Axel Luttgens <email@hidden>
- Date: Sun, 30 Oct 2011 10:49:58 +0100
Le 29 oct. 2011 à 21:30, Alex Zavatone a écrit :
> I agree it would be nice. get every thing of myList
>
> AppleScript is terribly inconsistant in this, in that it implies that it can be done, but it can't.
Well, in Ronald's example, theNameList is a list of records.
More exactly, an AppleScript list of AppleScript records.
What can be done with such entities is consistently and exhaustively described in the AppleScript Language Guide.
In particular, it is clearly stated that a filter reference form (aka a whose clause) can't "be used to filter the AppleScript objects list (page 92), record (page 96), or text (page 100)".
As a result, should one really want to avoid looping over the list's elements (the various records), one would have to resort to some application that implements some kind of collections liable to be filtered from within that application.
For example:
set theNameList to {¬
{myname:"Titzi", height:170, weight:55}, ¬
{myname:"Stephen", height:184.5, weight:75}, ¬
{myname:"Elke", height:174.5, weight:50}, ¬
{myname:"Silke", height:175, weight:60} ¬
}
tell application "System Events" to set theChooseList to value of first property list item of property list items of (make new property list item with properties {value:theNameList}) whose name is "myname"
--> {"Titzi", "Stephen", "Elke", "Silke"}
Not sure about the efficiency of the above, but there's no loop... ;-)
Axel
_______________________________________________
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