On 2007-12-06, at 07:27, Mark J. Reed wrote:
Here's a way to achieve what I think is the goal of your script in a more compact form. The key thing I'm illustrating is the use of the special input strings "0" and "1" to get relative dates out of AppleScript easily.
Er, I'm confused...
set rs_date to ((date (1 as text)) - 1 * days)
set re_date to date (0 as text)
What exactly do those do?
date "<some number>" = some day of the month at 00:00:00 (current user's time zone). Watch out for this because date "32" is bad and so is date "29" in February in a non leap year.
date "0" -- Current day of the month. Type this into Script Editor, compile, and watch what happens.
date (0 as text) -- Stop Script Editor from resolving "0" to the current date.
set rs_date to ((date (1 as text)) - 1 * days) -- First day of the month (script is run on) - 1 day = last day of the previous month.
Where do the report start and end times get entered into the script?
Sorry to say, I'm having trouble with the question. I'm formatting the date outputs with:
and then summing all the string values returned from multiple calls on the last line.
on FormatDateWithDelimiter(thePrefix, theDate, theDelimiter, theSuffix)
set d to theDelimiter
return thePrefix & ((month of theDate) as number) & d & day of theDate & d & year of theDate & theSuffix
end FormatDateWithDelimiter
set rs_date to ((date (1 as text)) - 1 * days)
set re_date to date (0 as text)
set ctime to time of (current date)
set r_time to FormatDateWithDelimiter("Report Time: ", re_date, "-", "_" & ctime)
set r_end to FormatDateWithDelimiter("Report End: ", re_date, "/", "")
set r_beg to FormatDateWithDelimiter("Report Start: ", rs_date, "/", "")
r_time & return & r_beg & return & r_end