Change tags with key command or script

I use Keyboard Maestro to great effect automating several key OmniFocus Routines. I’m an unsophisticated “programmer” so most of my KM macros utilize menu functions within OF.

I would like to create macros that quickly change the tags of a task. There’s no way, I believe, to do this through menu functions. Any advice on how I can tackle this?

What are you trying to do, specifically ? Is there a common tag are you trying to apply ? What’s the use case ?

A common use case would be to remove all tags from the current task and replace with the “Waiting For” tag. I find that I spend more time than I like fiddling with the tags. The multi-tag functionality of OF3 is fabulous but I’d love to automate changing tags from one (or multiple) tags to another one (or multiple) tag.

Is that helpful?

Here is a Omni-Automation Plug-In. Does it solve your problem ?

	"type": "action"
// Twitter: @unlocked2412
(() => Object.assign(
    new PlugIn.Action(selection => {

        // USER DATA -----------------------------------------
        const tagName = 'Waiting';

        // OMNI JS CODE ---------------------------------------
        const omniJSContext = () => {
            // main :: IO ()
            const main = () => {
                return => (

            // FUNCTIONS --
            // OmniFocus OmniJS --------------------------------------------
            // addTag :: Tag Object -> OFItem -> OFItem
            const addTag = oTag => item => {
                return item

            // tagFoundOrCreated :: Tag Name -> Tag Object
            const tagFoundOrCreated = strTag =>
                tagNamed(strTag) || new Tag(strTag)

            // MAIN -----------------------------------------
            return main()

        return omniJSContext()

    }), {
        validate: selection => selection.tasks.length > 0

This post was flagged by the community and is temporarily hidden.

1 Like

You are welcome, @kevinhardman. You can paste the code and save it in a file with .omnijs extension. Then, place it in your Plug-In OmniFocus folder. It should appear in the menu. If you have any doubts, I will be glad to answer them.

You’re very kind. Pardon the very basic questions:

Where is Plug-In folder located?
I assume I can just use TextEdit to save the file? Or would you recommend another tool?
This is JavaScript correct?

On Automation Menu, click Plug-Ins. And, in the widget that is displayed, right click on OmniFocus in iCloud Drive. Then, Reveal in Finder.

Of course. Any text editor will do the job.

Yes, it is written in the JavaScript language.

Thank you. I’m on my way!

1 Like