| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
That won't work as is if myList was originally defined within a handler - as virtually all Studio variables are - since it's then a local variable by default and 'my' won't operate - you'll get an error.
On 2005, Mar 21, , at 7:59 PM, Martin Fuhrer wrote:
I want to create a list of items, eg. a list of numbers from 5000 to -5000. In Script Editor I can run the script:
set myList to {}
repeat with n from 1 to 10000
set end of myList to 5000 - n --SLOW!!
end repeat
Unfortunately, this is slow (about 30 seconds on my Powerbook G4 1.5 GHz). A much faster method is:
set myList to {}
set myListRef to a reference to myList
repeat with n from 1 to 10000
set end of myListRef to 5000 - n --FAST!!
end repeat
This takes less than a second when run in Script Editor.
Unfortunately, the second script will not work in an Applescript Studio project. The loop produces the "NSCannotCreateScriptCommandError (10)". The first script runs fine in Applescript Studio, but once again, takes about 30 seconds to complete.
If I recall correctly, 'my' worked for me:
repeat with n from 1 to 10000
set end of my myList to 5000 - n --FAST!!
end repeat
_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-studio mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/email@hidden This email sent to email@hidden
| References: | |
| >Re: Fastest Method to Append to a List (From: Mark Butcher <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.