• 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: Yvan KOENIG <email@hidden>
  • Date: Thu, 28 Sep 2006 12:02:25 +0200


Le 28 sept. 2006 à 10:46, Philip Aker a écrit :

On 2006-09-27, at 21:48:19, Yvan KOENIG wrote:

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

To fix this situation, place the id of the messages which meet the search criteria into a list.
When the loop is done, move the message ids in the list to the desired location. Then we can talk about optimization

Philip Aker

Thanks Philip Aker

But it seems that you missed what we already did:

De :   email@hidden
Objet : Rép : New to applescript: year of
Date : 27 septembre 2006 19:11:52 HAEC
À :   email@hidden


Le 27 sept. 2006 à 18:26, Francis Derive a écrit :

Hello

Thanks, I didn't thaught to the get every messages issue.

Here are two versions:

-- version 1
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 (get every message of mailbox laSource)
if year of (get date received of myMessage) = 2005 then move myMessage to mailbox laDestination
end repeat
end if
end tell


-- version 2 here, the get is not required
set {laSource, laDestination} to {"zzz", "xyz"}

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


Yvan KOENIG

-+-+-+-+


The last attempts where only done to test the Emmanuel's proposal.

Yvan KOENIG


 _______________________________________________
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: Philip Aker <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>)
 >Re: New to applescript: year of (From: Philip Aker <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