Process tasks from Mail Drop

Hi all,

I use Mail Drop a lot but the problem is that additional information like @context and ::Project isn’t parsed.

My idea is to re-parse the selected task(s) in the inbox:

tell application "OmniFocus"
        -- Target the content of the front window
        tell content of front window
                -- Retrieve every selected task
                set theTasks to value of every selected tree
                -- Notify the user if no tasks are selected
                if theTasks = {} then
                        display alert "Unable to swap selected task names and notes." message "No tasks were selected. Please select one or more OmniFocus tasks and try again." as warning
                end if

                display alert "Ready to Swap Selected Task Names and Notes?" message "Once you do this, you will loose any formatting applied to your notes." buttons {"Cancel", "Continue"} cancel button "Cancel"

                repeat with aTask in theTasks
                        tell aTask
                                set theText to name & return & note
                        end tell
                        tell application "OmniFocus"
                                parse tasks into default document with transport text theText
                        end tell

                        delete aTask
                end repeat
        end tell
end tell

There are some problems with this script:

  • The second tell application "OmniFocus" (Line 33) looks wrong to me but I couldn’t make it work without it.
  • When the parse ends with an error the task is gone.
  • The usage of multiple pieces like @context ::Project doesn’t work.

Any ideas to solve these problems?


  • I agree the second tell application "OmniFocus" looks odd. Not sure what’s up with that.

  • If parse tasks fails, nothing has changed in your database, and then you delete the task. So you’ll need some way of checking that parse tasks succeeded. If it doesn’t throw an error you can catch, you could count the number of items in the database before and after parse and make sure it increases before deleting aTask.

  • I’m not sure what you mean by

The usage of multiple pieces like @context ::Project doesn’t work.

Could you please provide an example that IS working and one that you expect to work but doesn’t?