Skip to content

Instantly share code, notes, and snippets.

@jrarseneau
Created October 1, 2014 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrarseneau/e0abe8edfaff9965305c to your computer and use it in GitHub Desktop.
Save jrarseneau/e0abe8edfaff9965305c to your computer and use it in GitHub Desktop.
Mail to OmniFocus for OS X Yosemite
-- Mail to OmniFocus by J.R. Arseneau
-- http://theinterstitial.net/
--
-- Small AppleScript that works in Yosemite to mimick
-- the Clip-o-Tron from The Omni Group.
--
-- v1.0 - 30 September 2014
--
-- Known Issues:
--
-- - Will only do 1 message at a time (no multi-select or threads)
--
tell application "Mail"
set theSelectedMessages to selection
set the theMessage to item 1 ¬
of the theSelectedMessages
set theMessageID to the message id of the theMessage
set theMessageSubject to the subject of the theMessage
set theMessageBody to the content of the theMessage
set theMessageSender to the sender of the theMessage
set theMessageRecipient to address of first recipient of the theMessage
set theMessageDate to the date sent of the theMessage
set theMessageURL to "message://%3c" & theMessageID & "%3e" & "\n\n" & "From: " & theMessageSender & "\n" & "Subject: " & theMessageSubject & "\n" & "Date: " & theMessageDate & "\n" & "To: " & theMessageRecipient & "\n\n" & theMessageBody
tell application "OmniFocus"
tell quick entry
make new inbox task with properties {name:theMessageSubject, note:theMessageURL}
open
end tell
-- Make sure task name is selected for easy editing
tell application "System Events"
keystroke tab
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment