The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus for iPad (http://forums.omnigroup.com/forumdisplay.php?f=63)
-   -   iOS5 Killer addition > You can flag mails > You can script mail rule to add to OF :)) (http://forums.omnigroup.com/showthread.php?t=22418)

stevenjohn 2011-10-19 07:53 PM

iOS5 Killer addition > You can flag mails > You can script mail rule to add to OF :))
 
All,

Taking a look around iOS5, surely the best news there is that you can now flag mails on your iPad (and prob phone too, havent checked yet)? So you can set a mail rule up in OSX to send flagged mails to the OF inbox?

My workflow is very much using the OF inbox for anything, so if i have an email to deal with when I'm out and about, I'll typically want to get it into my Mac OF inbox for when I'm back in the office. If i can deal with it on my iPad I'll do it straight away.

For me the [url]http://forums.omnigroup.com/showthread.php?t=22146[/url] email provided by OF is too slow to use - quickly flagging mails when your out and about, then having a OSX Mail rule to turn flagged messages into OF inbox items will make life a LOT easier.

I'm going to go and hunt out the scripts that do that, but I'd have thought this would be a massive topic for all OF users, it is for me.

As soon as I have a play, will post back with script updates and anything I find - if anyone already has working scripts, please post them here.

Thanks, Steve.

Christian 2011-10-19 08:13 PM

I am not sure you can actually do that without a custom script. It will neither work with mail rules since those ignore flagged items altogether. Neither is there an Automator action availible to check for flagged actions I think. So it would have to be a mail script that ideally had to be executed automatically. But I do not know how well such works.

stevenjohn 2011-10-19 09:07 PM

Checking this out, on the one hand it looks very easy - but there's a difficult snag to deal with...

All that required is to use the existing standard "Send to omnifocus" rule thats added to mail - condition is that if the subject contains "+omnifocus", then it gets added to OF using the script /Applications/OmniFocus.app/Contents/Resources/MailAction.applescript

Its all there.

The issue is that in the Condition List, there is not a condition "If message is flagged" - as it assumes flagging is something done once you download a message, i.e. an action.

I have done a few searches on how to add a custom condition into the mail rule list, but nothing helpful popped up - if we can get this condition added to the mail rules, then this will be easy to get working.

Anyone out there got any ideas on how to add this custom condition to the mail rule set? I notice that "Smart Mailboxes" have a "If message is flagged" condition, so maybe its possible to grab the code for this from there?

Kind regards, Steve

ende 2011-10-28 09:47 AM

I'm incredibly interested in this as well. I found a thread with a AppleScript but it seems a bit out of date ( [url]http://forums.omnigroup.com/showthread.php?t=10575[/url] )

Looking at the Mail Rules, I wondered if something could be done with editing the header list, but to no avail. With gmail, for example, 'starred' items are stored (I believe) in a separate folder or given a label, and flags in Mail.app work in their own way, and a translation takes place. This would be different for other mail services and mail clients.

I'll keeping looking around.

stevenjohn 2011-10-30 07:03 PM

[QUOTE=ende;103459]I'm incredibly interested in this as well. I found a thread with a AppleScript but it seems a bit out of date ( [url]http://forums.omnigroup.com/showthread.php?t=10575[/url] )

Looking at the Mail Rules, I wondered if something could be done with editing the header list, but to no avail. With gmail, for example, 'starred' items are stored (I believe) in a separate folder or given a label, and flags in Mail.app work in their own way, and a translation takes place. This would be different for other mail services and mail clients.

I'll keeping looking around.[/QUOTE]
Great someone else is interested in this - I havent found anything new as yet, but I'm keen to find a method that just adds a new "If mail is tagged" condition to mail rules so that we can use the standard add to OF script - I find apple scripts that run on my mail can often cause more issues than theyre worth...

ende 2011-10-30 07:35 PM

Another thought here is to somehow use smart folders in mail.

whpalmer4 2011-10-30 08:56 PM

[QUOTE=stevenjohn;103518]Great someone else is interested in this - I havent found anything new as yet, but I'm keen to find a method that just adds a new "If mail is tagged" condition to mail rules so that we can use the standard add to OF script - I find apple scripts that run on my mail can often cause more issues than theyre worth...[/QUOTE]
Fly in the ointment is that mail rules aren't run if the message has already been marked read by another client, which means now you have to both flag the message and mark it unread. Seems easier to do half as many steps and run a script when you get back to the Mac that handles all of the flagged messages.

Brad I 2011-10-31 09:53 AM

I can't even find the "flag mail" setting on my iPad. How do you do it?

whpalmer4 2011-10-31 11:51 AM

If you are viewing a message, there should be a Mark link in the upper right part of the message viewer. Tap that, then flag. IOS 5 only — with earlier versions, it just shows Mark Unread.

Brad I 2011-10-31 07:15 PM

Ok, thanks. I didn't see it at first because my exchange mail doesn't show it. But Gmail does. Wonder why.

whpalmer4 2011-10-31 07:57 PM

Perhaps the Exchange server doesn't support marking a message as unread? Haven't ever used one, and intend to keep it that way :-)

Christian 2011-11-18 01:09 PM

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?

jdh 2011-11-19 06:06 AM

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 [i]new[/i] 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 Mail.app 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.

Christian 2011-11-19 11:15 AM

Hmmm...unfortunately I still did not find the time to learn AppleScript...apple should build that function in...

nevwild 2012-01-03 03:24 PM

I found it!
 
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 [url]http://www.hanchorllc.com/2011/12/11/omnifocus-task-auto-import-via-ios-mail-flags/[/url]

script is as follows:

[CODE]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[/CODE]

stevenjohn 2012-01-03 06:22 PM

Great work :)) Will be trying this out!

emory 2012-08-07 09:24 AM

fyi an Exchange account in Mail.app 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).


All times are GMT -8. The time now is 06:38 AM.

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