(* Create Yojimbo Note From Apple Mail Includes Tags Support and Growl Notifications Jim Correia September 9, 2006 http://www.listsearch.com/Yojimbo/Thread/index.lasso?342#2169 Tags Support and Growl Notifications added by Shawn Blanc October 3, 2009 Based heavily on scripts by John Gruber and Fraser Spiers: http://daringfireball.net/2007/05/yojimbo_netnewswire_mailsmith and http://www.speirs.org/wiki/Scripts#Add_front_Safari_tab_to_Yojimbo The content of the new Yojimbo note will contain the body of the currently selected email message, and the title will be set to the mesage subject. The script prompts for tags, which must be separated by ", " — that is, comma-space. *) 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:" & tab & _sender & return set _messageString to _messageString & "Subject:" & tab & _subject & return set _messageString to _messageString & "Date:" & tab & _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 "" repeat with m in messageList set _contents to _contents & my generateMessageText(m) end repeat -- prompt for tags set _tags to {} set _dlog2 to display dialog "Set tags (if any):" default answer ¬ "" default button 2 cancel button 1 set _action2 to the button returned of _dlog2 if _action2 = "" or _action2 = "Cancel" then return else set _answer to text returned of _dlog2 if _answer is not "" then set AppleScript's text item delimiters to ", " set _tags to text items of _answer end if end if -- create the new note tell application "Yojimbo" set _new_item to (make new note item with properties {contents:_contents, name:_name}) add tags _tags to _new_item end tell tell application "GrowlHelperApp" set the allNotificationsList to {"Success Notification", "Failure Notification"} set the enabledNotificationsList to {"Success Notification", "Failure Notification"} register as application ¬ "Mail to Yojimbo Script" all notifications allNotificationsList ¬ default notifications enabledNotificationsList ¬ icon of application "Yojimbo" notify with name ¬ "Success Notification" title ¬ "Note Created" description ¬ "" & _name & "" application name "Mail to Yojimbo Script" end tell end tell end tell end run