(* http://veritrope.com Entourage to Evernote Version 1.0 April 23, 2009 Project Status, Latest Updates, and Comments Collected at: http://veritrope.com/tips/entourage-to-evernote Some choices inspired by the following scripts/authors: -- Mike Hall (http://mph.puddingbowl.org/) -- Ernie Soffronoff -- Daniel N. Byler's DEVONthink script -- NetNewsWire To Pukka and Yojimbo -- Jan Erik Mostrom's script -- David Nunez scripts -- MANY, MANY OTHERS! Installation: A few options.... -- You can highlight the email messages you want to archive into Evernote and double-click this script file; -- You can save this script to ~/Documents/Microsoft User Data folder or simply drag the script into the Entourage Script Menu Items folder and it is immediately available for use. -- Keyboard shortcuts can also be assigned to AppleScripts in the script menu using the System Preferences "Keyboard & Mouse Settings". FastScripts Installation (Optional, but recommended): -- Download and Install FastScripts from http://www.red-sweater.com/fastscripts/index.html -- Save this script to ~/Library/Scripts/Applications/Microsoft Entourage -- Set up your keyboard shortcut in FastScripts Preferences *) property successCount : 0 property MailTitle : "" property EVTag : "" property myTitle : "" (* CHECK FOR GROWL *) tell application "System Events" set processnames to name of every process end tell if "GrowlHelperApp" is in processnames then tell application "GrowlHelperApp" set the allNotificationsList to {"Success Notification", "Failure Notification"} set the enabledNotificationsList to {"Success Notification", "Failure Notification"} register as application  "Entourage to Evernote" all notifications allNotificationsList  default notifications enabledNotificationsList  icon of application "Evernote" end tell end if (*MAIN PROGRAM *) tell application "Microsoft Entourage" try if (selection is not 0) then set defaultTag to "Email Message" set userInput to  text returned of  (display dialog "Enter Tags, separated by colons or commas:" & return & return &  "NOTE: Default Tag is 'Email Message'" default answer defaultTag) set theDelims to {":", ","} set EVTag to my Tag_List(userInput, theDelims) set theMessages to current messages set EVnotebook to my Notebook_List() repeat with thisMessage in theMessages set myTitle to the subject of thisMessage set myContent to the content of thisMessage set ReplyAddr to the sender's address of thisMessage set EmailDate to the time received of thisMessage set myText to "Message from mailto:" & ReplyAddr & " on " & EmailDate & ":" & return & return & myContent tell application "Acorn" set n to Çevent EVRNcrntÈ given Çclass EnxtÈ:myText  , Çclass EnttÈ:myTitle  , Çclass EnnbÈ: EVnotebook, Çclass EnggÈ:EVTag set Çclass EVddÈ of n to EmailDate set Çclass EVsuÈ of n to ReplyAddr end tell set successCount to successCount + 1 end repeat if "GrowlHelperApp" is in processnames then tell application "GrowlHelperApp" -- GROWL SUCCESS notify with name  "Success Notification" title  "Import Success" description "Successfully Exported " & successCount &  " Messages to Evernote!" application name "Entourage to Evernote" end tell set successCount to 0 end if else if "GrowlHelperApp" is in processnames then tell application "GrowlHelperApp" -- GROWL FAILURE FOR NO SELECTION notify with name  "Failure Notification" title  "Import Failure" description  "No headline or tab selected!" application name "Entourage to Evernote" end tell else if "GrowlHelperApp" is not in processnames then -- NON-GROWL ERROR MSG. FOR NO SELECTION display dialog "No headline or tab selected!" with icon 0 end if (* ERROR HANDLING *) on error errText number errNum if "GrowlHelperApp" is in processnames then tell application "GrowlHelperApp" -- GROWL FAILURE FOR ERROR notify with name  "Failure Notification" title  "Import Failure" description "Failed to export " & return & myTitle &  "\" due to the following error: " & return & errText  application name "Entourage to Evernote" end tell else if "GrowlHelperApp" is not in processnames then -- NON-GROWL ERROR MSG. FOR ERROR display dialog "Item Failed to Import: " & errNum & return & errText with icon 0 end if end try end tell (* SUBROUTINES *) --TAG SELECTION SUBROUTINE on Tag_List(userInput, theDelims) set oldDelims to AppleScript's text item delimiters set theList to {userInput} repeat with aDelim in theDelims set AppleScript's text item delimiters to aDelim set newList to {} repeat with anItem in theList set newList to newList & text items of anItem end repeat set theList to newList end repeat return theList set AppleScript's text item delimiters to oldDelims end Tag_List --EVERNOTE NOTEBOOK SELECTION SUBROUTINE on Notebook_List() tell application "Acorn" activate set listOfNotebooks to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTEBOOKS *) (*GET THE NOTEBOOK LIST *) set EVNotebooks to every Çclass EVnbÈ repeat with currentNotebook in EVNotebooks set currentNotebookName to (the name of currentNotebook) copy currentNotebookName to the end of listOfNotebooks end repeat (*SORT THE LIST *) set Folders_sorted to my simple_sort(listOfNotebooks) (*USER SELECTION FROM NOTEBOOK LIST *) set SelNotebook to choose from list of Folders_sorted with title "Select Evernote Notebook" with prompt  "Current Evernote Notebooks" OK button name "OK" cancel button name "New Notebook" if (SelNotebook is false) then (*CREATE NEW NOTEBOOK OPTION *) set userInput to  text returned of (display dialog "Enter New Notebook Name:" default answer "") set EVnotebook to userInput else set EVnotebook to item 1 of SelNotebook end if end tell end Notebook_List --SORT SUBROUTINE on simple_sort(my_list) set the index_list to {} set the sorted_list to {} repeat (the number of items in my_list) times set the low_item to "" repeat with i from 1 to (number of items in my_list) if i is not in the index_list then set this_item to item i of my_list as text if the low_item is "" then set the low_item to this_item set the low_item_index to i else if this_item comes before the low_item then set the low_item to this_item set the low_item_index to i end if end if end repeat set the end of sorted_list to the low_item set the end of the index_list to the low_item_index end repeat return the sorted_list end simple_sort