Here is a script which enhances Jim Correia's "MailtoYojimbo"
applescript. In addition to sending the email, it will add to
Yojimbo's Comments the date a message was sent and the recipient or
sender, as appropriate. In addition it adds tags "email" and one of
"in" or "out" to the message. Messages can be sorted by date by
sorting on the comment field. It works in Mail 2.1 and Yojimbo 1.4.2
under OS X 10.4.8.
Steve
Script follows:
(* Script to
1. pipe a single selected email message from Apple Mail to Yojimbo
2. Add to comments: date sent (yyyy/mm/dd), sender (for emails
received) or recipient (for emails sent)
3. Add tags "email" and either "in" or "out" to indicate received or
sent mail.
Important: to determine if you sent or received the message, specify
all your email addresses in the section with comment starting "ENTER
YOUR EMAIL ADDRESS AS SHOWN"
Based on MailtoYojimbo Applescript by Jim Correia of Bare Bones
Software
Originally posted in the Yojimbo Talk Forum: http://
www.listsearch.com/Yojimbo/Message/index.lasso?2169
Also at://www.hawkwings.net/2006/09/04/script-to-pipe-emails-into-
yojimbo/
Steve Samuels
[EMAIL PROTECTED]
*)
on generateMessageText(m)
tell application "Mail"
set _sender to sender of m
set _subject to subject of m
set _date to date received of m as string
set _contents to content of m
set _messageString to "From: " & _sender & return
set _messageString to _messageString & "Subject: " & _subject & return
set _messageString to _messageString & "Date: " & _date & return
set _messageString to _messageString & return & return & _contents
end tell
end generateMessageText
on run
tell application "Mail"
tell message viewer 1
set messageList to selected messages
set _name to subject of item 1 of messageList
set _contents to ""
--get content
repeat with m in messageList
set _contents to _contents & my generateMessageText(m)
end repeat
--get date sent
set _date to date sent of item 1 of messageList
set _year to year of _date
set _yr to _year as string
set _month to month of _date
-- coerce month to number
set _month to _month + 0
set _smon to _month as string
if _month < 10 then
set _smon to "0" & _month
end if
set _day to day of _date as string
if day of _date < 10 then
set _day to "0" & _day
end if
set _ldate to _yr & "/" & _smon & "/" & _day & " "
--get sender
set _sender to sender of item 1 of messageList
set _ssender to extract name from _sender
set _person to "<:" & _ssender
set _from_me to false
set _saddr to extract address from _sender
-------------------------------------------------
--ENTER YOUR EMAIL ADDRESS AS SHOWN
------------------------------------------------
if _saddr is "[EMAIL PROTECTED]" then
set _from_me to true
--Enter additional email addresses by removing the comment dashes and
repeating the next two lines for each
--else if _saddr is "[EMAIL PROTECTED]" then
--set _from_me to true
end if
--if mail is from me get first recipient
if _from_me is true then
set theRecipients to to recipients of item 1 of messageList
if (exists name of item 1 of theRecipients) then
set _pers to name of item 1 of theRecipients
set _person to ">:" & _pers
end if
if not (exists name of item 1 of theRecipients) then
set _addr to address of item 1 of theRecipients
set _person to ">:" & _addr
end if
tell application "Yojimbo"
set aNewNoteItem to make new note item with properties
{contents:_contents, name:_name, comments:_ldate & _person}
add tags {"email", "out"} to aNewNoteItem
end tell
else
tell application "Yojimbo"
set aNewNoteItem to make new note item with properties
{contents:_contents, name:_name, comments:_ldate & _person}
add tags {"email", "in"} to aNewNoteItem
end tell
end if
end tell
end tell
end run
--
------------------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <[email protected]>.
To unsubscribe, send mail to: <[EMAIL PROTECTED]>
List archives: <http://www.listsearch.com/yojimbotalk.lasso>
Have a feature request, or not sure if the software's working
correctly? Please send mail to: <[EMAIL PROTECTED]>