Request: AppleScript to Parse OF Inbox Items from Mail Drop like the Mail Rule used to do

Request:
I’d like an AppleScript that I can run over the OF Inbox to parse the actions I get from Mail Drop. I’m looking for the same parsing as the old mail rule used to handle: projects, contexts, start/end dates, flag, estimated time. (Why am I not using the OF mail rule? I don’t always use Mail.app, often working straight from Gmail in Chrome.)

I looked on the forums and couldn’t find anything helpful/working (there seemed to be one topic, “Process tasks from Mail Drop”, but that didn’t seem go anywhere and I’m not confident in my AppleScript authoring at this point to take it on myself.

Purpose:
In my case, I’m trying to automate as much of the manual work that goes along with managing actions that arise from my calendar, which I use a lot. I have adopted a pattern of creating actions to remind me to (a) prepare and (b) debrief meetings, so that I can ensure I have good discipline around getting things done. With all of these meetings, the sheer work of checking my calendar, adding actions, etc is time-consuming and repetitive, and I be believe that’s better suited for machines to do.

I have some ideas for other similar automation (Zapier/IFTTT listening for triggers from Trello, SalesForce, etc, all converting into OF actions) so a general AppleScript to parse the OF Inbox using the OF Mail Rule syntax would be handy as opposed to a bunch of custom scripts for each individual event/trigger type.

Context:
My work is balanced between my home office and a lot of travel, and despite a lot of collocated work teams and ad hoc sessions, most of the people I work with day-to-day are highly calendar-driven. (I would love if we used stuff like Slack and Hangouts more casually, but that’s not my current reality.)

Current Condition:
I use Zapier to scan my Google calendar for new entries. When it finds a new event, it sends an email to my OmniFocus Mail Drop address to create an action reminding me to prepare for that meeting. Right now, the subject of those emails are simply “Prepare for your meeting’’ on <meeting date/time>’”.

Multiple times per day, I need to go the OF Inbox, read each of the new actions that get added via this approach, set the project (varies, but am thinking of setting it to ‘Meetings to prepare’), update the context (always ‘Thinking:Planning’), set the due date (always the day/time of the meeting), and set an estimate (always ‘5m’).

I have a similar Zapier rule that creates a ‘follow-up’ action within 15 minutes of a meeting starting. This action is due the same day of the meeting, attached to a different project (‘Meetings to debrief’), using a different context (‘Braindead:Hygiene’), and 5m estimate. Again, I have to check the OF Inbox regularly and set all of the properties manually in the current state to make this work.

Target Condition:
Continue to use Zapier to fire off emails, but change the email subject in Zapier of the new meeting trigger to:

“Prepare for your meeting ‘[meeting name]’ on [meeting date/time]’ ::Meetings to prepare #[meeting date/time] $5m”

to get an action of the same name in OF.

With the AppleScript, I’d like it to parse all of the actions in the OF Inbox using the OF mail rule parsing to convert it into an action with properties as follows:

  • Name: Prepare for your meeting ‘[meeting name]’ on [meeting date]
  • Project: Meetings to prepare
  • Due date: [meeting date/time]
  • Estimate: 5m

Similarly, I’d like the follow-up trigger to send an email with the subject as follows which parses accordingly:

Handle follow-ups from your meeting ‘[meeting name]’ on [meeting date/time]’ ::Meetings to debrief #[meeting date/time] $5m

The benefit of being applescript is that I could setup an Automator action or something to regularly scan the inbox, so I don’t have to lift a finger.

So, anyone up for helping? Despite being a former programmer, My AppleScript Fu is not the best and I could use some help. I’m sure others would appreciate this hack too while OF Mail Drop does not have this kind of functionality (which I have pinged the support ninjas about already).

Yes, please! Priority for me is being able to add multiple OF tasks from one Evernote note: after all, most meetings I’m in result in more than one thing I have to do :-p The old OF mail rule does this by recognizing every line that starts with “–” (without the quotes) as a new task.

I keep hoping that the OF team will implement this as part of Mail Drop functionality as they promised…

I use taskclone to send todo items in Evernote to OF today. Works well.

I’ll post my OF re-parsing scripts once I clean up the unit tests.

What output do you get from taskclone? Can you assign projects, contexts and/or due dates to tasks from within Evernote? And if so are the processes tedious?

taskclone looks perfect, but I’m not looking to pay for yet another product. OmniFocus had this functionality with the old mail rule, and has promised to add it to MailDrop. OF: any updates for us?

Output from taskclone is just a new task using MailDrop with a link to the Evernote note in the notes field. You can’t specify any additional information out of the box.

I use the AppleScripts I created to re-parse Mail Drop actions along the lines of the old Mail Rule to parse it for extra info. That makes it much easier.

Here’s my workflow:

  1. Create a task in my Evernote note. For example (without quotes): ‘Send meeting minutes to Mike ::Project X @Email #today’ or ‘Redraft the pitch presentation ! @Writing #tomorrow #next friday’
  2. Tag the Evernote note with taskclone and sync Evernote.
  3. Sync OmniFocus and select the task in my inbox.
  4. Click my ‘Parse Inbox Tasks’ AppleScript (or use Keyboard Maestro) and watch as it takes the task name as transport text re-parses the info into the fields. So ‘Send meeting minutes to Mike ::Project X @Email #today’ becomes:
    Task name: Send meeting minutes to Mike
    Project: Project X
    Context: Email
    Due: Today at 5:00 PM

With these scripts, it’s good enough to use Mail Drop from anywhere (Zapier, IFTTT, regular email, etc) just like the old Mail Rule. The script handles all the arguments of Mail Drop including the variety of dates, flagging, etc.

I still want to update the unit tests with better test fixtures (using ASUnit) before shouting from the rooftops, so I’ll try to do that this weekend and update the thread.

2 Likes

I like the sound of that AppleScript. I use a couple with OF now – one to collect from Evernote by searching for tagged notes and another for logging completed tasks in Evernote.

Here’s a more elegant option than my own including some automation: http://joebuhlig.com/omnifocus-auto-parser/

I’m doing an analysis to see what the gaps are between this and what I’ve put together. My guess is that the one I just linked above covers most scenarios.

2 Likes

Sorry, I know I’m super late to the game on this topic, but I’ve been searching high and low and haven’t been able to find anything that seems to work. This conversation, and what @kraigparkinson initially described is exactly what I’m looking for as well. Does anyone know of any scripts or Hazel automations that I could let run on a Mac Mini in my home office that auto-parse my Inbox as new tasks come in with a certain syntax? Something similar to Joe Buhlig’s auto-parser? (it seems that he hasn’t updated it in a while, or has found an alternative.)

Thanks everyone!

Summary of observations while testing: 20181110

So a typical string could look like this:


  • Fix bathroom lamps @FullFocus ::house #2d

From OmniFocus Auto-Parser

delay 1

  • It can take up to 1-15 or more minutes for the action item to appear in OF
    (Hazel will scan the folders, in OF use ⌘ S to force a sync with the server)

  • One or more tags can be used.

  • Notes can be after // slashes, or in the Mail body, or in both the subject line and the Mail body.

  • Use exact names of existing projects, obviously best with simple names (Folder names cannot be used)

  • Any mistake in the syntax will leave the task item in the Inbox (so it’s not lost).

  • NB there is a risk of a mismatch of the format of 2 dashes: – task name, but not — task name.
    (The 2nd was produced in iOS Notes on the iPad.)

    • therefore you may want to enter the AppleScript and set it to 1 dash: ” - ”

@the line:
If taskName starts with the dash “-” then

  • In Mail (or else) after the dash: ” - ” leave a space after the start dash before the task item name!

.-. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Here’s an example of the full [adapted] syntax you can use in the subject line:

  • Fix bathroom wiring! @FullFocus ::House #1d #2d $30 min //It’s a lot of work.

This creates a flagged task named “Fix bathroom wiring” with the context of “After Hours and project of “House/Car - SA”. Its start date will be Friday with a due date of next Monday. The time estimate for it will be 30 minutes and the note will be “It’s driving me crazy.”

  • “-“ sets the name of the task.
  • The “!” after the task name is what sets the flag.
  • “@“ sets the context.
  • “::” sets the project.
  • The first “#” sets the defer date.
  • The second “#” sets the due date. If only one “#” exists, Omnifocus assumes it’s a due date.
  • “$” sets the time estimation.
  • “//“ sets the note for the task.

Slightly adapted syntax from

2 Likes