Using Omni Automation to deal with tags on repeating tasks in OmniFocus

I recently watched (and greatly enjoyed!) William Gallagher’s OmniFocus Workflows session over at Learn OmniFocus.

At around the 38-minute mark, there was some discussion about the side effects of applying a tag to a repeating task. In essence: when an instance of a repeating task has a tag, and that instance is completed, the next instance of the task will also have the tag. Depending on the tag in question, this may not be the desired outcome.

In William’s case, his ‘First Ten’ tasks are determined each day and shouldn’t carry across to the next:

“I would really like an automation that, if I ticked it as done in First Ten, it also removed the tag.”

William Gallagher

In response to this, Tim jokingly suggested that I might have something like that already, and I had a good laugh because he was spot-on: I have a very similar issue with my ‘Due Today’ tag, which is automatically applied by my Scheduling plug-in.

So, here are a couple of different ways I’m approaching this scenario.

Option 1: Remove the tag when the task is completed

This is, in many ways, the most obvious option, and the approach that William suggested.

There is one fairly significant drawback to this approach, however, which is that (at least for the moment) Omni Automation actions can’t be triggered automatically when a task is completed. As a result, the action needs to be run manually each time you want to complete a task.

Because I’m all-in on automation and I have several things I want to happen when I complete a task, I’ve already trained myself to use a custom keyboard shortcut (⌥ C) to complete a task on macOS rather than using ‘Space’ or the mouse. This shortcut runs my Custom Complete plug-in, which first marks the task as complete, and then, among other things, can remove one or more tags from a task’s repetitions. (It also prompts you if completing the task leaves any action groups or projects stalled, and does a bit of tidy-up work for some of my other plug-ins, if they’re installed.)

I personally use this when it’s convenient, and then catch the rest of the instances using the option below.

Option 2: Remove the tag in the background after the task has been completed

If it’s not convenient to use the option above, or if I simply forget, I have set up a fallback: every ten minutes Keyboard Maestro runs a small Applescript that removes the tag from any tasks that are remaining, but not due today:

tell application "OmniFocus"
  evaluate javascript "tagsMatching('Due Today')[0].remainingTasks.forEach(task => { if (Calendar.current.startOfDay(task.effectiveDueDate) >  Calendar.current.startOfDay(new Date())) { task.removeTag(tagsMatching('Due Today')[0]) } })"
end tell

This particular script does rely on the tasks in question being due on the day that you want the tag to be applied, but, at least in our scenarios, this is the case. The Keyboard Maestro script can be downloaded below. If you’d like to use it, you will need to update the two instances of Due Today in the script with First Ten, or whatever tag you are using.

Option 3: Create a separate instance of the task before tagging

One final option is to ‘skip’ the original task before applying the tag. That way, the repetition already exists without the tag and you are simply ticking off a non-repeating task.

My Duplicate and Drop plug-in is designed for exactly this purpose: it duplicates a repeating task so that it can be modified (for instance, by applying a tag) without affecting future instances.

If you wanted to take this to the next step, you could modify this plug-in to duplicate and drop the task and then apply your specific tag.

This option might be preferable where you would like the tag to persist some of the time, but not always (for example, if there were some tasks that should always be tagged with ‘First Ten’).

The best approach, or approaches, to this kind of scenario is, or are, going to depend on your particular use case and preferences; but in any case, I hope this short post has given some of you some ideas about how you can work with repeating tasks and their associated tags using Omni Automation.

Leave a Reply