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

Rép: New to applescript: year of


  • Subject: Rép: New to applescript: year of
  • From: Yvan KOENIG <email@hidden>
  • Date: Thu, 28 Sep 2006 14:40:24 +0200

Le 28 sept. 2006 à 12:54, has a écrit :


on makeDate(y, mo, d, h, mi, s)
(*
Make new date object given, year, month, day, hour, minute and second as integers (month can also be given as a constant). Doesn't use date strings, so isn't affected by users' Date & Time preferences (i.e. localisation-independent).
*)
set dt to date (get "1")
set monthNames to {January, February, March, April, May, June, July, August, September, October, November, December}
if mo is not in monthNames then set mo to item mo of monthNames
set {dt's year, dt's month, dt's day} to {y, mo, d}
set dt's time to h * hours + mi * minutes + s
return dt
end makeDate


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

set startDate to makeDate(myYear, 1, 1, 0, 0, 0)
set endDate to makeDate(myYear + 1, 1, 1, 0, 0, 0)
tell application "Mail"
move (every message of mailbox laSource whose date received ≥ startDate and date received < endDate) to mailbox laDestination
end tell




Thanks, this one is really faster.

Here is a simple variant:


set myYear to 2005
set {laSource, laDestination} to {"zzz", "xyz"}
set avant1 to current date
set startDate to date ("01/01/" & myYear)
set endDate to date ("01/01/" & (myYear + 1))
tell application "Mail"
move (every message of mailbox laSource whose date received ≥ startDate and date received < endDate) to mailbox laDestination
end tell
set avant2 to current date


display dialog "durée : " & (avant2 - avant1)


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: Rép: New to applescript: year of
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: New to applescript: year of
  • Next by Date: Re: New to applescript: year of
  • Previous by thread: Re: Extracting Data from Get Info window
  • Next by thread: Re: Rép: New to applescript: year of
  • Index(es):
    • Date
    • Thread