• 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: New to applescript: year of
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New to applescript: year of


  • Subject: Re: New to applescript: year of
  • From: Francis Derive <email@hidden>
  • Date: Thu, 28 Sep 2006 11:27:18 +0200


On Sep 28, 2006, at 6:48 AM, Yvan KOENIG wrote:


Le 28 sept. 2006 à 01:02, Emmanuel a écrit :

My advice is to always force dereferencing of the "item" in the first place. If you don't do it yourself, AppleScript will do it each time the variable is invoked in the loop, so if you use the loop variable more than once in the loop you're improving speed.


repeat with myLoopVariable in someList
set myLoopVariable to contents of myLoopVariable -- dereference once for all and be safe


Emmanuel

Hello Emmanuel.

It's the first thing I tried but it failed.


set {laSource, laDestination} to {"zzz", "xyz"}

tell application "Mail"
set k to count of messages of mailbox laSource
if k > 0 then
repeat with myMessage in (every message of mailbox laSource)
set my_message to contents of myMessage
if year of (get date received of my_message) = 2005 then move my_message to mailbox laDestination
end repeat
end if
end tell


Bonjour Yvan,

I noticed Emmanuel wasn't afraid to set myMessage to contents of myMessage (myLoopVariable to contents of myLoopVariable).
Courageously, I ran it, several times, and couldn't get any error.


Trying to investigates what happens ...

It is not clear to me how Emmanuel's
"set myLoopVariable to contents of myLoopVariable -- dereference once for all and be safe"
is really "once for all" because - inside the repeat, will be repeated - won't it be ?



Francis. _______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: New to applescript: year of
      • From: Francis Derive <email@hidden>
    • Re: New to applescript: year of
      • From: Yvan KOENIG <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>)

  • Prev by Date: Re: New to applescript: year of
  • Next by Date: Re: New to applescript: year of
  • Previous by thread: Re: New to applescript: year of
  • Next by thread: Re: New to applescript: year of
  • Index(es):
    • Date
    • Thread