Re: a question about accessing list items through a reference
Re: a question about accessing list items through a reference
- Subject: Re: a question about accessing list items through a reference
- From: Philip Aker <email@hidden>
- Date: Wed, 30 May 2007 23:05:41 -0700
On 2007-05-30, at 21:41:16, Tetsuro KURITA wrote:
A reference to an item of a list may usually appear in a loop of "repeat with ~ in ~" statement as follows.
(* Script A *) property a_list : {1, 2} repeat with ref_to_item in a_list set contents of ref_to_item to 3 end repeat
Above script works well. But very slow. As well known, to accelerate loop,items of AppleScirpt's list must be accessed through a reference to a list or script object as follows.
(* Script B *) property a_list : {1, 2} repeat with ref_to_item in my a_list set contents of ref_to_item to 3 -- error of number -10006 end repeat
But this script does not work. Someone says I can drop "my" before "a_list". But we need "my" in the point of view of the performance, and it should be considered that the list is in the other script object in some cases.
property pItemList : {1, 2} repeat with p in pItemList set contents of p to 3 end repeat set r to result
script s set plist to a reference to my pItemList repeat with p in plist set contents of p to (3 * 3) end repeat return my pItemList end script {r, run script s}
-->{3, {9, 9}}
|
_______________________________________________
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