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 for iPad
FAQ Members List Calendar Search Today's Posts Mark Forums Read

iOS5 Killer addition > You can flag mails > You can script mail rule to add to OF :)) Thread Tools Search this Thread Display Modes
Perhaps the Exchange server doesn't support marking a message as unread? Haven't ever used one, and intend to keep it that way :-)
Did any body find a good way to utilise the flagging of mail on iPad to trigger mail on mac to create a task from the flagged mail?
The only way to do this, unfortunately, would be to create a custom Applescript that runs on a scheduled basis (e.g. through launchd) to poll the mailbox looking for flagged messages to add to OmniFocus. As somebody else has already pointed out, Mail rules only trigger on new mail as it's coming in, not on anything that's already in the Mail app (even marking messages as unread doesn't re-trigger the Mail rules).

I used to have a kludgy script that did this with an "Action" folder in an older version of Mail... Similar workflow in that I would move messages to the "Action" folder and then the script which ran every five minutes would pick up the message and add it to my OF inbox. I'm using Gmail rather than these days and the script is probably buried in my backups somewhere now, but it wasn't a huge modification from the various Mail-to-OmniFocus scripts that can be found around the forums -- basically it just needs to be modified to search Mail instead of being trigger from a Mail rule.
Hmmm...unfortunately I still did not find the time to learn should build that function in...
I found the following script which takes flagged actions out of Apple Mail on your mac to your OF inbox. I have set it to run every 15 min via iCal

Full blog post can be found at

script is as follows:

on run

	tell application "Mail"
		repeat with _acct in imap accounts
			--Look For Flagged Messages in the INBOX
			set _acct_name to name of _acct
			set _inbox to _acct's mailbox "INBOX"

			set _msgs_to_capture to (a reference to 
				(every message of _inbox 
					whose flagged status is true))

			repeat with eachMessage in _msgs_to_capture
				set theStart to missing value
				set theDue to missing value
				set theOmniTask to missing value

				set theTitle to the subject of eachMessage
				set theNotes to the content of eachMessage

				set theCombinedBody to "message://%3c" & message id of eachMessage & "%3e" & return & return & theNotes

				tell application "OmniFocus"
					tell default document
						set newTaskProps to {name:theTitle}
						if theStart is not missing value then set newTaskProps to newTaskProps & {start date:theStart}
						if theDue is not missing value then set newTaskProps to newTaskProps & {due date:theDue}
						if theCombinedBody is not missing value then set newTaskProps to newTaskProps & {note:theCombinedBody}

						set newTask to make new inbox task with properties newTaskProps
					end tell
				end tell

				set flagged status of eachMessage to false

			end repeat

		end repeat
	end tell

end run
Great work :)) Will be trying this out!
fyi an Exchange account in will not work with this, as the IMAP Accounts account type will not return an Exchange account.

You must specify the account name and the Inbox name of 'Inbox' (not INBOX).

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to finish off a Hazel Rule NewlyHooked OmniFocus Extras 2 2012-10-14 09:48 PM
Mass de-flag in context/perspective script. roadtrip OmniFocus Extras 5 2012-01-26 12:57 PM and OmniFocus Mail Rule chinarut OmniFocus 1 for Mac 0 2008-06-28 09:26 AM
possible to script addition of midpoints? the doug OmniGraffle General 0 2008-02-27 06:16 PM
Adding Tasks Via Send To OmniFocus Mail Rule, Mailtags, & Mail Act-On reuben OmniFocus 1 for Mac 0 2007-11-18 06:07 PM

All times are GMT -8. The time now is 12:37 AM.

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