The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   omnifocus + Apple Mail + gmail flags/starred integration (http://forums.omnigroup.com/showthread.php?t=10575)

smagdali 2008-11-13 05:41 AM

omnifocus + Apple Mail + gmail flags/starred integration
 
Bear with me.

I currently use omnifocus for managing most of my todos, but I also flag incoming emails that need attention by setting the flag in Apple Mail. I then have a Smart Folder for flagged items that I return to periodically to clear down. Apple Mail flagged items also appear in the 'starred' folder on the underlying gmail account.

This works pretty well, but actually means I am maintaining 2 parallel todo lists.

Omnifocus will let me turn emails into actions based on To: or Subject: filters, but nothing else.

So my question is,

Is there a rule I can apply or a macro I can run that will add a string to the subject based on a mail's flagged status?

Then I can flag away, and have Omnifocus pick up the Actions.

Happy to use a mail plugin or something clever on the gmail side

mr206 2008-11-14 04:45 AM

Wow! That would be awesome! I just (finally?) switched over to mail.app from Thunderbird, to which I had a long allegiance, just because of OF's integration with mail.app.

If there were more and more elegant ways to get e-mails to be to do items, that would be *lovely*.

Lucas 2008-11-14 08:14 AM

If you go into the Mail rules, you can just change the "Send to OmniFocus" rule to activate on flagged messages instead of the subject line.

watchit 2008-11-14 12:37 PM

[QUOTE=Lucas;50843]If you go into the Mail rules, you can just change the "Send to OmniFocus" rule to activate on flagged messages instead of the subject line.[/QUOTE]

This seems like the perfect solution but Apple Mail does not allow a rule to be activated on whether a message is flagged or unflagged.
Am I missing something here?

Lucas 2008-11-14 05:41 PM

Ah you are correct. Sorry.

But you can set a Mail Rule to work on "every message" and then run the following AppleScript, which will add every flagged message to the inbox.

[QUOTE]
-- Sloppily patched together by Lucas to import flagged messages.

(* Derived by dbyler from "Jott to OmniFocus" to work with reQall mail. See below. *)

-- Derived from work that is Copyright © 2007, Curtis Clifton All rights reserved.
-- Modified to work specifically with Jott messages.

-- If true, then the sender of the message is included in the action's description.

-- From [url]http://forums.omnigroup.com/showthread.php?t=7651[/url]

property includeSender : false

property messageSender : "reQall"

using terms from application "Mail"
on perform mail action with messages theMessages
try
set theMessageCount to count of theMessages
repeat with theMessageIndex from 1 to theMessageCount
if (flagged status of item theMessageIndex of theMessages) then
my process_message(item theMessageIndex of theMessages)
end if
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


on process_message(theMessage)
tell application "Mail"
set theContent to content of theMessage
set theDate to date sent of theMessage
set messageId to message id of theMessage
set theSubject to subject of theMessage
end tell

tell application "OmniFocus"
-- set messageStart to (offset of "added to reQall" in theContent) + 21
-- set messageEnd to (offset of "Invite your friends" in theContent) - 76
-- set taskName to strings messageStart through messageEnd of theContent
set taskName to theSubject
if (includeSender) then
set taskName to taskName & "—" & messageSender
end if
set theDoc to default document
tell theDoc
set propRecord to {name:taskName}
set theTask to make new inbox task with properties propRecord
end tell
tell theTask
set start date to theDate
set note to return & return & theContent
tell note
set theURL to "message://<" & messageId & ">"
set linkText to "Original Message"
insert linkText at before first character
set value of attribute "link" of style of paragraph 1 to theURL
end tell
end tell
end tell
end process_message
[/QUOTE]

ende 2011-10-28 09:31 AM

[QUOTE=Lucas;50869]Ah you are correct. Sorry.

But you can set a Mail Rule to work on "every message" and then run the following AppleScript, which will add every flagged message to the inbox.[/QUOTE]

Thanks so much for writing that script. It doesn't seem to work for me, could it be out of date with changes in Mail.app since it was written?

Also why on earth would Apple not include 'Message is flagged' as a trigger?


All times are GMT -8. The time now is 07:25 PM.

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