Member
2008-05-08, 01:37 PM
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.
Code:
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 & ")"
else
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
Last edited by dmcg; 2008-05-08 at 02:23 PM..
Reason: Update script