• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: a question about accessing list items through a reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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}}




Philip Aker
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

References: 
 >a question about accessing list items through a reference (From: Tetsuro KURITA <email@hidden>)
 >Re: a question about accessing list items through a reference (From: Tetsuro KURITA <email@hidden>)

  • Prev by Date: Re: InDesign, current view
  • Next by Date: Re: InDesign, current view
  • Previous by thread: Re: a question about accessing list items through a reference
  • Next by thread: Multiple copies of Citrix running
  • Index(es):
    • Date
    • Thread