The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Today's Posts

 
Apple Mail Jott to OmniFocus AppleScript Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Howdy,

I've modified the basic AppleScript that comes with OmniFocus so that it pulls the Jott message out of the e-mail. It assumes that a single message is a single task. I even included a link back to the original e-mail. However, the link I put into the note doesn't work quite right.

Does anyone know of a way to put a link into a note processed by "parse tasks"? I include something like "Jott message: message://<1206587236.14269@jott.com>", which is the correct format for the link, but it doesn't automatically appear as a link. Worse yet, when I manually type a space after it, OmniFocus creates two links: "message://" and "1206587236.14269@jott.com". It seems to view the "<" as a separator (which may be correct from an RFC standpoint).

If I instead send the text "Jott message: <message://<1206587236.14269@jott.com>>", I manage to get the "<" included, but it also includes the first "<". The link becomes: "<message://<1206587236.14269@jott.com>".

The script is below if you'd like to try it out.

. John
--
-- Derived from work that is copyright 2007 The Omni Group. All rights reserved.
-- Modified to work specifically with Jott messages.

using terms from application "Mail"
-- Trims "foo <foo@bar.com>" down to "foo@bar.com"
on trim_address(theAddress)
try
set AppleScript's text item delimiters to "<"
set WithoutPrefix to item 2 of theAddress's text items
set AppleScript's text item delimiters to ">"
set MyResult to item 1 of WithoutPrefix's text items
on error
set MyResult to theAddress
end try
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
return MyResult
end trim_address

on process_message(theMessage)
set theContent to content of theMessage
set messageStart to (offset of "Jott:" in theContent) + 6
set messageEnd to (offset of "Listen" in theContent) - 2
set theSubject to text messageStart through messageEnd of theContent
set theText to theSubject & return & "Jott message: message://<" & message id of theMessage & ">"
tell application "OmniFocus"
tell default document
parse tasks with transport text theText with as single task
end tell
end tell
end process_message

on perform mail action with messages theMessages
try
set theMessageCount to count of theMessages
repeat with theMessageIndex from 1 to theMessageCount
my process_message(item theMessageIndex of theMessages)
end repeat
on error m number n
tell application "OmniFocus"
log "Exception in Mail action: (" & n & ") " & m
end tell
end try
end perform mail action with messages
end using terms from
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
omnifocus + Apple Mail + gmail flags/starred integration smagdali OmniFocus 1 for Mac 5 2011-10-28 09:31 AM
Apple Mail to Omnifocus, with attachment chipjoyce Applying OmniFocus 1 2010-07-14 12:45 PM
Omnifocus task/action to Apple Mail gandalf44 OmniFocus Extras 1 2009-05-27 12:53 PM
Jott -> Mail.App -> OmniFocus jrapp111 OmniFocus Syncing 3 2008-08-13 07:43 PM
adding +omnifocus for mail rules - Apple problem? mhedstrom OmniFocus 1 for Mac 12 2008-08-08 08:26 PM


All times are GMT -8. The time now is 11:56 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.