Re: Avoiding repetition
Re: Avoiding repetition
- Subject: Re: Avoiding repetition
- From: Nigel Garvey <email@hidden>
- Date: Sat, 17 Jul 2004 01:28:39 +0100
Paul Berkowitz wrote on Fri, 16 Jul 2004 07:25:24 -0700:
>
On 7/16/04 7:01 AM, "Nigel Garvey" <email@hidden>
>
wrote:
>
> set folderName to item (((current date) - (date "Monday, 6 January 1000
>
> 00:00:00")) mod weeks div days + 1) of {"A", "B", "C", "D", "E", "F", "G"}
>
> myAction(folderName)
>
>
>
> :-)
>
>
Useful for dealing with any date at all. If it's only ever going to be used
>
with current date or other recent dates, is there any reason to go all the
>
way back to 1000? Why not just use date "Monday, January 5, 2004 12:00:00
>
AM" or any other recent Monday, and save on the mod division? (You never
>
know, we might some day hit a number too big as a result of the initial
>
subtraction. ;-) Such things have been known to occur.) This does make it
>
valid for any date whatsoever, of course. So if Bernard comes across some
>
old files on his machine dating from 1472 it's reassuring to know that the
>
routine will still work.
! :-D
Yes, you're right. Any past Monday would serve as the reference date for
Bernard's purposes. (If in fact it does suit Bernard's purposes.) I used
the first Monday in the AppleScript date range because the code is in
effect a "get-day-of-week" process. I was saving a couple of seconds'
development time for anyone who wanted to adapt it as such. (If your week
starts on a Sunday, use the previous day instead.)
I didn't understand your point about the mod division. It has to be done
anyway in the above process. And you can use 'date "Friday, 31 December
9999 23:59:59"' instead of 'current date' and it will still work. (Well.
It *does* still work at the moment. One can never be sure what will still
work in the future.) ;-)
NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.