| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Sep 27, 2006, at 9:48 PM, Yvan KOENIG wrote:
In general, it's not safe to modify a collection while you're iterating over it. It can be done, but you have to be careful about how you do it. One way is to use an explicitly index-based loop and count backwards ("repeat with i from (count messages) to 1 by -1" ). Another way is to get the list of messages into a local variable and then iterate over that ("set ml to every message; repeat with m in ml"), though that does not work for collections that use index-based specifiers, and it uses more memory at once. A third way -- the best one, assuming it works -- is to not use a loop at all and use a "whose" specifier, though how to do that in this particular case is a bit circuitous thanks to the "year of" problem ("move every message whose date received is greater than date "1/1/2005" and whose date received is less than date "1/1/2006"). --Chris Nebel AppleScript Engineering |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden This email sent to email@hidden
| References: | |
| >Re: New to applescript: year of (From: Yvan KOENIG <email@hidden>) | |
| >Fwd: New to applescript: year of (From: Yvan KOENIG <email@hidden>) | |
| >Re: New to applescript: year of (From: Francis Derive <email@hidden>) | |
| >Re: New to applescript: year of (From: Emmanuel <email@hidden>) | |
| >Re: New to applescript: year of (From: Yvan KOENIG <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.