People
A couple of years ago (circa 2006), I posted a request on the BBS for a script(s) for Mail with automatic Julian Date and Message Number insertions.
Kindly, one of the members provided me with the scripts (attached). I am trying to re-establish contact with him, for another challenge. Unfortunately when I cleaned up my Mail accounts, I dumped his address.
So, if he reads this bulletin or if anyone knows the author of the script, please contact me at jnkendal@mac.com.
Regards
Jeffrey
PS. The challenge: In Mail, if either FORWARD or REPLY functions are used, put Julian Date and sequencial number in the first line/place or “Subject”.
property lastDate : ""
property lastMsgNo : 0
set jDay to do shell script "date +%j"
set jYear to do shell script "date +%y"
set theSubject to jYear & jDay & "/"
set theYEar to do shell script "date +%y" -- two digit year
set theMonth to do shell script "date +%m" -- two digit month
set theMonth2 to (do shell script "date +%B" & " | tr \"[:lower:]\" \"[:upper:]\"")
set theDay to do shell script "date +%d" -- two digit day of month
set theHour to do shell script "date +%H" -- two digit hour (24 hour clock)
set theMinute to do shell script "date +%M" -- two digit minute
set theSecond to do shell script "date +%S" -- two digit second
-- convert the month2 name to a 3 char name
set theMonth2 to characters 1 thru 3 of theMonth2 as string
set currentDate to jYear & jDay -- get current date
if lastDate = "" then -- i.e. first run of script
set lastDate to jYear & jDay
end if
if lastDate = currentDate then
set lastMsgNo to lastMsgNo + 1
else
set lastMsgNo to 1
set lastDate to currentDate
end if
set msgNo to text -2 thru -1 of (("00" & lastMsgNo) as string) -- make 2 digit number
set theSubject to currentDate & "/" & msgNo
set theBody to "DE VJNK NR " & jYear & jDay & "/" & msgNo & return ¬
& "R " & theDay & theHour & theMinute & "Z " & theMonth2 & theYEar & return ¬
& "FM KENDAL JN" & return ¬
& "TO" & return ¬
& "BT" & return ¬
& "UNCLAS" & return & return ¬
& "BT" & return & return & return & return & return & return & return & return ¬
& "NNNN"
tell application "Mail"
activate
set theNewMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell theNewMessage to set visible to true
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the background.
end tell
property lastDate : ""
property lastMsgNo : 0
set jDay to do shell script "date +%j"
set jYear to do shell script "date +%y"
set theSubject to jYear & jDay & "/"
set currentDate to jYear & jDay -- get current date
if lastDate = "" then -- i.e. first run of script
set lastDate to jYear & jDay
end if
if lastDate = currentDate then
set lastMsgNo to lastMsgNo + 1
else
set lastMsgNo to 1
set lastDate to currentDate
end if
set msgNo to text -2 thru -1 of (("00" & lastMsgNo) as string) -- make 2 digit number
set theSubject to currentDate & "/" & msgNo
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:theSubject}
tell theNewMessage
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the background.
set visible to true
end tell
end tell