Re: Getting record items of a sublist
Re: Getting record items of a sublist
- Subject: Re: Getting record items of a sublist
- From: Shane Stanley <email@hidden>
- Date: Sun, 30 Oct 2011 09:27:31 +1100
On 30/10/2011, at 6:22 AM, Ronald Hofmann wrote:
yes, my list can become pretty big and I think that something like myname of theNameList would be faster than a loop.
You may be right, but one of the biggest mistakes you can make in AS (and elsewhere) is to guess what will be fastest, especially if there are no events involved.
FWIW, what you want to do is simple enough using AppleScriptObjC:
-- make the list an array set theNameList to current application's NSArray's arrayWithArray_(theNameList) -- get the myname values return theNameList's valueForKey_("myname")
And if you're happy to use ASObjC Runner, you can call it from a vanilla AS script like this:
script extractProperty set {theList, theKey} to current application's NSApp's passedValue() as list set theList to current application's NSArray's arrayWithArray_(theList) return theList's valueForKey_(theKey) end script
tell application "ASObjC Runner" to set theResult to run the script {extractProperty} passing {theNameList, "myname"} with result returned
But my admittedly minimal tests suggest that a loop is likely to be as fast as using ASObjC Runner unless the list gets very large (using AppleScriptObjC itself would be much faster). |
_______________________________________________
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