Implementation Details for OmniFocus 2.14 Automation

Unless it does it in one step, I’d rather a python script as applescript can be slow.

However, I would want it to be functionally identical to the editorial solution!

Has anyone found a way to skip the confirmation dialog when entering a new task? Trying to do the most basic form of this: add a single task to a single project. But it always needs me to hit Save no matter how I go about it.

1 Like

Yeah, I’d like to know this.

2 Likes

Ken wrote a bit about that here: Automation in OmniFocus 2.14 (released 2016-04-26)

Yep. I saw that. But he never gave a solution that I can see.

So happy to have this awesome new functionality!

One thing I could not figure out how to include a note with an item via the /paste function.

I’ve been using Drafts to send lists of items to OmniFocus via the List in Reminders action which takes text following a delimiter and places it in the Note.

Looking at the documentation again, looks like it could be made to work with a recursive action, but I’d prefer not to do it that way.

Is that the case or am I missing something?

In the absence of the ability to target a specific project with the /paste action, I’m trying to have my workflows set the clipboard then launch OmniFocus to the folder that my project lives in.

I just don’t know how to get the ‘folder-id’ for a specific folder. The folder is at the path /School/Operational/ in my OmniFocus Database. I have tried “School : Operational” (URL encoded) but OmniFocus tells me it can’t find a folder so named.

Any other routes?

1 Like

I think the right solution will be to add an autosave parameter to the /add action.

In general: if you open OmniFocus and set up a project (or individual action) the way you want it to be (with notes, repeats, due dates, sequential vs. parallel, etc.), you can tap the Share button and Copy the TaskPaper text form of that project onto your pasteboard, where you can paste it into any text editor to see how it looks.

For example:

- This task has a note
	Here is the note for the task.
	
	The note spans multiple lines.
- This task doesn't have a note

Hope that helps!

I’m not sure there’s a good way to look up a folder’s unique id on iOS at the moment, but on Mac you can select your target folder and use Copy As Link (found in the contextual menu and the Edit menu) to get its URL form (e.g. <omnifocus:///folder/z0ohQgzFg65>).

Obviously, this is just my opinion. That single parameter is what makes this stand out as a exceptional.

1 Like

I too would love to see the /autosave parameter added - It would be the final step required for me to create the fully automated workflows that I crave!

1 Like

It doesn’t seem to like this format:

@due(July 7th)

How can I specify a date like this? (each time I run it, the next instance of July 7th is used)

@murkee That’s odd. Maybe try without the “th”? i.e. @due(July 7). That works for me.

ScottyJ

Will try thanks. As a workaround, I have a variable with -254 days and things like that (it’s an annual template for a long term project).

Similarly, how would I say ‘3rd of next month’ ?

FYI: We’ve added an &autosave=true option to the omnifocus:///add URL action for our next TestFlight build.

Looks like “next month 3” will do this right now, though that might be fragile as we improve date parsing in the future.

4 Likes

In an upcoming release (it’s committed to trunk, but probably too late for 2.15 at this point—so likely in version 2.16) the /paste URL action will accept more specific targets of the form target=/folder/FOLDERNAME or target=/task/PROJECTNAME (or even target=/task/TASKIDENTIFIER).

As part of building this, I ended up extending our OmniFocus reference URLs to support name lookups, rather than just identifier lookups, so you can use URLs of the form:

  • omnifocus:///folder/FOLDERNAME
  • omnifocus:///task/PROJECTNAME
  • omnifocus:///context/CONTEXTNAME

The name lookups support our usual “SmartMatch” completion matching, so if you have a project named “My Project” you’ll be able to use “omnifocus:///task/mp” to get to it (or whatever the first match for “mp” turns out to be).

9 Likes

That worked! Thanks (and sorry for the long-delayed response!)

Is there any news on how to specify a folder in a taskpaper/editorial template, please? (coping with a space in folder name)

2 Likes

You should be able to use URL encoding for the space (e.g. “My Project” becomes “My%20Project”), or you could just leave the space out (“MyProject”) since that’s likely to be the best SmartMatch hit (unless you actually do have a “MyProject” project as well).

Thanks for that, but how do I specify this in the taskpaper template to be picked up in the editorial script?

re: Automation in OmniFocus 2.14 (released 2016-04-26)

It’s not there yet: that’s coming in 2.16 TestFlight builds, after 2.15 ships.