OmniFocus Automation - Kanban Board

Hi Vishae (and Sal),

This is a great and simple solution. I like the concept that it is working in OmniFocus.

I am having one problem. I have set up the 3 perspectives (To Do/ In Progress/ Waiting for) and created a Keyboard Maestro Macro to get the three windows on one screen. When I am trying to run the “In Progress” script in the To Do window nothing is happening. However when I am in Tag view it is running correctly.

Do you have any suggestions?

When you say you run the “In Progress” script, you’ve selected the task and clicked the button and nothing happened? When looking at the inspector for the task, did the appropriate tag get assigned?

Can you try Cmd+K to refresh the list?

oh, that is very useful! If you don’t mind, can I add this to the bundle?

Can this work with automation bundles that include icons, or does only work with single-action scripts?

Hi Vishae, thanks for your quick response.

I have found the cause of the problem, not the solution yet. In my Keyboard Maestro macro I am hiding the inspector, than it is not working. When I show the inspector it is working.

Greetings! Again, thank you for sharing your creativity.

If you don’t mind, can I add this to the bundle?

Certainly you can use these scripts or any of the scripts in the omni-automation.com website in your projects.

Can this work with automation bundles that include icons, or does only work with single-action scripts?

I’m not sure I understand your question? Encoded script URLs are most often used to run Omni Automation scripts from 3rd-party apps and webpages. Did you want to use them in plug-ins?

Here’s the plug-in for displaying the child tags in the Kanban tag set, which will be created if needed. UPDATE: Thanks to @draft8 for the wisdom. I’ve added code for creating child tags if needed, and reordering them if needed.

/*{
	"type": "action",
	"targets": ["omnifocus"],
	"author": "Otto Automator",
	"identifier": "com.omni-automation.of.display-kanban-tags",
	"version": "1.0",
	"description": "Plug-in will select all of the child tags of the “Kanban” tag set, which will be created if needed.",
	"label": "Display Kanban Tags",
	"shortLabel": "Kanban"
}*/
(() => {
	var action = new PlugIn.Action(function(selection, sender){
		
		// IDENTIFY KANBAN TAG, CREATE IF MISSING
		var targetTag = flattenedTags.byName("Kanban") || new Tag("Kanban")
		
		// ADD KANBAN CATEGORIES IF MISSING
		var tagTitles = ["To Do", "In Progress", "Waiting", "Done"]
		tagTitles.forEach(title => {
			if (!targetTag.children.byName(title)){
				new Tag(title, targetTag)
			}
		})
		
		// REORDER THE CATEGORIES
		tagTitles.forEach(title => {
			var tag = targetTag.children.byName(title)
			moveTags([tag], targetTag)
		})
		
		// SHOW THE TAGS
		var tagIDs = targetTag.children.map(tag => tag.id.primaryKey)
		var tagIDsString =  tagIDs.join(",")
		URL.fromString("omnifocus:///tag/" + tagIDsString).open()
		
	});
	
	return action;
})();

@Sal’s code helpfully creates a Kanban tag if none is found, but is a bit less helpful if Kanban lacks the expected children:

We just need to be a bit more consistent with the found or created pattern, extending it to the child tags, as well as the parent tag.

Perhaps something more like:

/*{
    "author": "Author Name",
    "targets": ["omnifocus"],
    "type": "action",
    "identifier": "com.mycompany.showKanban",
    "version": "0.1",
    "description": "Kanban tags found or created, and selected",
    "label": "showKanban",
    "mediumLabel": "showKanban",
    "paletteLabel": "showKanban",
}*/
(() => {
    return new PlugIn.Action(() => {

        // ------- THE KANBAN TAG FOUND OR CREATED -------
        const
            targetTag = flattenedTags.byName(
                'Kanban'
            ) || (new Tag('Kanban')),

            //  IDS OF THE CHILD TAGS (FOUND OR CREATED) -
            tagIDs = [
                'To Do',
                'In Progress',
                'Waiting',
                'Done'
            ].map(
                tagName => (
                    targetTag.children.byName(
                        tagName
                    ) || (new Tag(tagName, targetTag))
                ).id.primaryKey
            ),

            // ---------- URL WITH LIST OF IDs -----------
            url = `omnifocus:///tag/${tagIDs.join(',')}`;

        // ---------- URL COPIED TO THE CONSOLE ----------
        return (
            // In Console:
            console.log(url),

            // --- AND USED IN THE APPLICATION WINDOW ----
            URL.fromString(url).open()
        );
    });
})();

That’s very strange, because I also hide the inspector (and the sidebar) and I can’t reproduce the issue. When I activate the script, the appropriate tags gets assigned.

When you say it’s not working, is it that the task doesn’t display in the correct column, or does the tag not get assigned either?

Also, have you tried manually aligning your windows (don’t use Keyboard Maestro), then run the script and see whether it works then? I’m just wondering whether something in your Keyboard Maestro script might be interfering with something (though I can’t see how).

I’ve updated the plug-in to now include the script to display the kanban tags.

Excellent work! Thank you for sharing such a useful tool with the Automation community. I look forward to downloading the update when it’s posted. Cheers. – SAL

It is the KeyBoard Maestro macro causing the problem. Could you share the one you use?

A dead link at the moment ?

( It seems to 404 )

oops, sorry! I’ve updated the link now.

I’m not sure my Keyboard Maestro script would be useful to other people. It’s essentially a collection of “Type a Keystroke” commands that activate keyboard shortcuts for other applications (and it’s very hacky).

Here’s how my KM script works:

  • Open OmniFocus
  • Pause 5 second
  • “Type a Keystroke” action (Shift + Ctrl + Opt + Cmd + 1) <-- This has been set to open the “To Do” Perspective" (I use Karabiner to map “Shift + Ctrl + Opt + Cmd” to Cap Lock)
  • Pause .5 second
  • “Type a Keystroke” action (Ctrl + Opt + d) <-- resizes the window to 1/3 window width and move to the left of the screen (this uses Magnet app)
  • Pause .5 second
  • “Type a Keystroke” action (Opt + Cmd + N) <-- Open new OmniFocus window
  • repeat the above but using the keyboard shortcuts to open the other perspectives and resizing+moving window to the correct position.

As you can see this relies on a couple of other applications (Magnet and Karabiner) and personal keyboard shortcuts, so it really wouldn’t be helpful to others. And it’s so inelegant (all this pausing)!
I’m finding myself using Sal’s script above for opening the Tag view more often.

I have a different approach, I will try to use yours:

@vishae that’s a really useful piece of work! It fits right in with what I needed.

Because I’m partial to the three column layout myself (I’m so old I’ve used actual physical Kanban boards on factory floors …) I’ve rejigged a Keyboard maestro to put everything in place as I like it.
I’ve uploaded it on the Keyboard Maestro Forum if anyone’s interested.

Thank you for posting that - a few people have asked me for my Keyboard Maestro script and I always feel bad that I don’t have something useful for them.

FYI, here’s a link to the Omni Automation website version of the Kanban plug-in inspired by this conversation!

https://omni-automation.com/omnifocus/plug-in-kanban-board.html

Thank you for pulling this into Omni Automation, Sal! Any chance you have the images in colors that work with light mode, i.e. non-gray?

Ah. Right. How about if I upload the icon files and everyone can change them the way they like? I’ve added a dark version of the icon source files (PNG) to the webpage!

https://omni-automation.com/omnifocus/plug-in-kanban-board.html

Kanban-Dark-Icons.zip (114.8 KB)

1 Like

Thank you for taking the time to add those dark icons, sir!