Created
September 8, 2014 19:28
-
-
Save sirtimbly/748351ed29c19d4cbf43 to your computer and use it in GitHub Desktop.
mail to evernote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Slightly modified version of Efficient Computing's AppleScript: http://efficientcomputing.commons.gc.cuny.edu/2012/03/17/copy-email-message-in-mail-app-to-evernote-applescript/ | |
tell application "Mail" | |
--get selected messages | |
set theSelection to selection | |
--loop through all selected messages | |
repeat with theMessage in theSelection | |
--get information from message | |
set theMessageDate to the date received of theMessage | |
set theMessageSender to sender of theMessage | |
set theMessageSubject to the subject of the theMessage | |
set theMessageContent to the content of theMessage | |
set theMessageURL to "message://%3c" & theMessage's message id & "%3e" | |
--make a short header | |
set theHeader to the all headers of theMessage | |
set theShortHeader to (paragraph 1 of theHeader & return & paragraph 2 of theHeader & return & paragraph 3 of theHeader & return & paragraph 4 of theHeader & return & return) | |
--import message to Evernote | |
tell application "Evernote" | |
synchronize | |
set theNewNote to (create note with text (theMessageURL & return & return & theShortHeader & theMessageContent)) | |
set the title of theNewNote to theMessageSubject | |
set the source URL of theNewNote to theMessageURL | |
set the creation date of theNewNote to theMessageDate | |
synchronize | |
end tell | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment