The Omni Group Forums

The Omni Group Forums (
-   OmniFocus Extras (
-   -   Export to GMail for iPhone (

dmcg 2008-05-08 01:37 PM

Export to GMail for iPhone
I know Ethan had a way more sophisticated version of this, and there may be others on this forum, but I've a simple script to export contexts, one per email, to Mail and then to GMail IMAP so that I can at least see my shopping list on the iPhone.
tell application "OmniFocus"
repeat with theContext in contexts of default document
set contextName to name of theContext
set body to ""
repeat with theTask in remaining tasks of theContext
set TaskProject to containing project of theTask
set taskLine to name of theTask & " (" & name of TaskProject & ")"
if theTask is next then
set taskLine to "* " & taskLine
else if theTask is blocked then
set taskLine to " (" & taskLine & ")"
set taskLine to " " & taskLine
end if

set body to body & taskLine & "
end repeat
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:false, subject:"@" & contextName, content:body}
close theMessage saving yes
end tell
end repeat
tell application "Mail"
set destination to (a reference to mailbox "tasks" of account "GMail")
set newMailList to (get messages in drafts mailbox)
set oldMailList to (get messages in destination)
delete oldMailList
move newMailList to destination
end tell
end tell

I hope it comes in handy.

Duncan McGregor

joowanlee 2008-06-16 01:30 AM

Thanks for posting this
Thanks a lot for posting this and as you said it did come in handy,I expect more of these kind of stuff from you.bye for now!

nanovation 2008-08-09 09:55 PM

Awesome! Thanks Duncan. Ethan's version was far too advanced for me as I'm just getting started. Your version was spot on.

All times are GMT -8. The time now is 08:32 AM.

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