On or near 12/5/00 6:40 PM, jaywest at [EMAIL PROTECTED] observed:
> I wondering if anyone has any suggestions, strategies or scripts for
> creating daily journals in Entourage? I guess ideally the solution might be
Here you go! The time and date routines are copied from the AppleScript guidebook Help modules. I suggest storing the first script with a name ending in "\smJ" (Cmd-Shift-J), and the second script ending in "\cmJ" (Cmd-Ctrl-J) to assign easy keyboard shortcuts.
I modified the beginning of the script to open an existing journal entry or create a new one. I believe in letting the computer do the work:
set datestmp to format_date_using(current date, "-", {"YYYY", "MM", "DD"})
set timestmp to format_time_using(current date, ":", {"HH", "MM"})
tell application "Microsoft Entourage"
try
set noteID to note ("Journal " & datestmp)
try
close noteID
on error
try
close window ("Journal " & datestmp)
end try
end try
set t to the content of noteID
set t to t & return & timestmp & return
set content of noteID to t
on error
set noteID to make new note with properties {name:"Journal " & datestmp, content:timestmp & return}
end try
open noteID
activate
end tell
on format_date_using(this_date_record, delimiter_string, format_list)
-- get the numeric day
set numeric_day to the day of this_date_record
-- get the month
set month_name to the month of this_date_record
-- convert month to number
set the list_of_months to {January, February, March, April ¬
, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if item i of the list_of_months is the month_name then
set the numeric_month to i
exit repeat
end if
end repeat
-- get the numeric year as text
set numeric_year to the year of this_date_record as string
set the formatted_date to ""
-- count the number of items in the list
set the item_count to the count of the format_list
-- parse the format list
repeat with i from 1 to the item_count
set this_item to item i of the format_list
if this_item is "D" then
set the formatted_date to ¬
the formatted_date & numeric_day as string
else if this_item is "DD" then
if the numeric_day is less than 10 then ¬
set numeric_day to ¬
("0" & (the numeric_day as string))
set the formatted_date to ¬
the formatted_date & numeric_day as string
else if this_item is "M" then
set the formatted_date to ¬
the formatted_date & numeric_month as string
else if this_item is "MM" then
if the numeric_month is less than 10 then ¬
set numeric_month to ¬
("0" & (the numeric_month as string))
set the formatted_date to ¬
the formatted_date & numeric_month as string
else if this_item is "YY" then
set the formatted_date to ¬
the formatted_date & ¬
((characters 3 thru 4 of numeric_year) as string)
else if this_item is "YYYY" then
set the formatted_date to ¬
the formatted_date & numeric_year
end if
if i is not the item_count then
-- add delimiter
set the formatted_date to ¬
the formatted_date & delimiter_string as string
end if
end repeat
return the formatted_date
end format_date_using
on format_time_using(this_date_record, delimiter_string, format_list)
set the time_index to the time of this_date_record
set the hour_index to ((the time_index) / hours) div 1
set the minute_index to ¬
(((the time_index) / minutes) - (the hour_index * 60)) div 1
set the seconds_index to ¬
((the time_index) - (the hour_index * 3600) - (the minute_index * 60)) div 1
set the formatted_time to ""
-- count the number of items in the list
set the item_count to the count of the format_list
-- parse the format list
repeat with i from 1 to the item_count
set this_item to item i of the format_list
if this_item is "H" then
set the formatted_time to ¬
the formatted_time & the hour_index as string
else if this_item is "HH" then
if the hour_index is less than 10 then ¬
set hour_index to ¬
("0" & (the hour_index as string))
set the formatted_time to ¬
the formatted_time & hour_index as string
else if this_item is "M" then
set the formatted_time to ¬
the formatted_time & the minute_index as string
else if this_item is "MM" then
if the minute_index is less than 10 then ¬
set minute_index to ¬
("0" & (the minute_index as string))
set the formatted_time to ¬
the formatted_time & minute_index as string
else if this_item is "S" then
set the formatted_time to ¬
the formated_time & the seconds_index as string
else if this_item is "SS" then
if the seconds_index is less than 10 then ¬
set seconds_index to ¬
("0" & (the seconds_index as string))
set the formatted_time to ¬
the formatted_time & seconds_index as string
end if
if i is not the item_count then
-- add delimiter
set the formatted_time to ¬
the formatted_time & delimiter_string as string
end if
end repeat
return the formatted_time
end format_time_using
--
Glenn L. Austin
Computer Wizard and Race Car Driver
<[EMAIL PROTECTED]>
<http://www.austin-home.com/glenn/>
