date snippet
date snippet
- Subject: date snippet
- From: Dean Ross-Smith <email@hidden>
- Date: Wed, 13 Dec 2000 08:04:46 -0800
Recently there was a thread on date conversion stuff. This handler
takes a TIFF file (which is really just a plate for a press)
containing a day of the week such as "12RJ-A-B@1.M.M" or
"##12RJ-A-B@1.M.M" and tries to figure out the month that the file is
really running in. In this format the routine is specific to my needs
but the code is there to suck up the date from the current month...
-- applescript is date stupid...
on dtidategrabber(mypage)
set numberlist to {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
set monthlist to {"January", "February", "March", "April",
"May", "June", "July", "August", "September", "October", "November",
"December"}
set myday to day of (current date) as integer
set mymonth to month of (current date) as string
set monthcounter to 1
set olddelimiters to text item delimiters
set text item delimiters to ""
set counter to 1
repeat until item counter of mypage "#"
copy 1 + counter to counter
end repeat
if item (counter + 1) of mypage is in numberlist then
-- date is 2 digits
set dayfolder to (items counter thru (counter + 1) of
mypage) as text
else
set dayfolder to item (counter) of mypage as text
end if
repeat until (item monthcounter of monthlist = mymonth)
copy 1 + monthcounter to monthcounter
end repeat
if (myday - (dayfolder as integer)) < -14 then
copy monthcounter - 1 to monthcounter
else if (myday - (dayfolder as integer)) > 14 then
set monthcounter to (monthcounter + 1)
end if
if monthcounter > 12 then
set monthcounter to 1
else if monthcounter < 1 then
set monthcounter to 12
end if
set text item delimiters to olddelimiters
return {monthcounter, dayfolder}
end dtidategrabber
- Follow-Ups:
- Re: date snippet
- From: What does not kill you only makes you stronger <email@hidden>