Change the status of a tag from Shortcuts?

I’d like to change the status of a tag from a Shortcut I can run on a schedule, using Autocuts. Is that something I can do from Shortcuts? Is there a way to run automation scripts with Shortcuts?

A few of us were playing with manipulating tags via scripting here:

I don’t think you can change tags via Shortcuts, but I could be mistaken. The new Shortcuts actions do include new ways of working with the OF database…

What are you trying to achieve? It might help with brainstorming your options.

Currently shortcuts don’t have the access to the OmniFocus database they would need to make changes to items, but we’ve identified some changes we can make that would allow that in the future. We’re tracking interest in the feature, so thanks for letting us know it’s something you’d like to see!


Yep, something similar. I want to create more sophisticated availability rules, mostly based on time. So, work tasks should only be available during work hours. I have a Phone Call tag that’s for calling businesses about things, which would probably have the same time constraints. Other tasks would only be available on the weekend.

I’m imagining doing that by “turning off” tags by setting them to On Hold. I can do that with a script on the Mac, but I’d rather do it on my phone, since it’s always running.

Right. In that thread, @kaitlin created an Omni Automation-compatible script that can essentially do what you’re describing. I (still!) haven’t played with Omni Automation, but you should be able to run those scripts on iOS, if I understood it correctly.

Running scripts/actions completely automatically is still effectively impossible on iOS, but you could create a Shortcut Automation that pops up a notification at the appropriate times. In turn, that notification could trigger the script that switches your tags around to get the behaviour you want.

In theory, anyway! I haven’t tried this myself.

Meaning I could tap the notification and have it run? That would be a decent compromise. How would I make that happen? I’m still not clear how to run scripts on iOS at all. :)

I’m not 100% on this working, because I’ve been negligent in keeping up on how Omni Automation is working on OF on iOS. Your best resource for scripting OmniFocus on iOS is probably here:

This page shows how to run a script in OmniGraffle from Shortcuts:

And then running said Shortcut from a Shortcuts Automation would simply mean creating a Personal Automation with a Time of Day trigger, then using the Run Shortcut action and selecting the script-running shortcut. When the time of day occurs, you’ll get a notification that can be used to trigger the Shortcut that runs the script.

Easy as a Rube Goldberg machine-baked pie…?

A more automatic but less iOS-independent option would be to use something like Keyboard Maestro on an always-running Mac. You could set up a macro that switched your key tags from On Hold to Active at given times of day pretty easily, and once OF syncs from Mac to iOS, it should bring that status change along, too.

In theory!

Ah, I see! I was missing the magic to run automation code from Shortcuts. The trick I was missing to construct a omnifocus://localhost/omnijs-run URL.

But that still prompts for approval every time it runs. I’m guessing there’s no way to get it to run without that interaction?

I may just have to give in and do it on the Mac with AppleScript. That’s not the worst thing.