"delay sent" for Apple's Mail application...
"delay sent" for Apple's Mail application...
- Subject: "delay sent" for Apple's Mail application...
- From: David Crowe <email@hidden>
- Date: Wed, 13 Jul 2005 16:11:06 -0600
Title: "delay sent" for Apple's Mail
application...
Eudora has the ability to send mails at a future date, and is
eminently scriptable.
Here's a script that I use to send a message at 9am on the next
business day (Monday to Friday) including warning me no more than once
a day that the email won't go out until tomorrow:
property LastWarned : {0, 0, 0}
tell application "Finder" -- to check whether it's Eudora that's
active
if
(name of first process
whose
frontmost is true) does not
start with
"Eudora"
then
activate
display
dialog "This function
can only be used when Eudora is active"
return
end
if
end tell
set CurrentDate to current
date
set CurrentDayMonthYear to {day
of CurrentDate, month
of CurrentDate, year
of CurrentDate}
set CurrentTime to
time of CurrentDate
set CurrentHours to
CurrentTime
div (60 * 60)
set CurrentSeconds to CurrentTime mod 60
set CurrentMinutes to (CurrentTime
mod (60 * 60)) div 60
-- Don't queue on
weekends
if CurrentHours < 9
and weekday of CurrentDate
Sunday and weekday of
CurrentDate
Saturday then
set
DaysToSkip to 0
else if weekday of
CurrentDate = Friday then
set
DaysToSkip to 3
else if weekday of
CurrentDate = Saturday then
set DaysToSkip
to 2
else
set
DaysToSkip to 1
end if
if CurrentHours 9
and
CurrentHours ¾
11 then
if
LastWarned CurrentDayMonthYear then
tell application "Eudora"
activate
try
display
dialog "This message
won't be queued until 9am on the following working
day." giving up
after 1
on
error
return
end
try
end
tell
set LastWarned to
CurrentDayMonthYear
end if
end if
set TomorrowMorning to CurrentDate + ((DaysToSkip
* 24) -
CurrentHours + 9) * 60 * 60
-
CurrentSeconds -
(CurrentMinutes * 60)
tell application "Eudora"
try
queue
message 1 for TomorrowMorning
end try
end tell
- David Crowe
_______________________________________________
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