Re: Month/Day Conundrums
Re: Month/Day Conundrums
- Subject: Re: Month/Day Conundrums
- From: Nigel Garvey <email@hidden>
- Date: Sun, 17 Dec 2000 10:40:10 +0000
I wrote on Sun, 17 Dec 2000 01:40:10 +0000:
>
"B.R." wrote on Thu, 14 Dec 2000 20:47:35 -0900:
>
>
>I have an AppleScript program which I use to send e-mail announcements.
>
>Works great -- sending them every Saturday for the Wednesday meeting 11
>
days
>
>later -- but now the meetings are on the 1st and third Wednesdays of each
>
>month. How could I write a script that if today is, say, the 17th and a
>
>Saturday, it will add 11 days to that (I know how to do that much), see
>
>whether that Wednesday is the 1st or 3rd Wednesday (not), and return some
>
>sort of result? Thanks.
>
>
on announceToday() -- returns true or false
>
tell (current date) + 11 * days to ,
>
return its weekday is Wednesday and ,
>
its day is in {1, 2, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21}
>
end announceToday
... or, to save up to six ticks a month:
on announceToday() -- returns true or false
tell (current date) + 11 * days to ,
return its weekday is Wednesday and ,
((its day) - 28) div 7 mod 2 is -1
end announceToday
>
if announceToday() then...
>
>
(The character after 'to' and 'and' should be the line-continuation
>
character, Option-L.)
NG