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.
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?
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:
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.
@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)
Thank you for taking the time to add those dark icons, sir!
@Sal, do you have a strong preference for offering this as two scripts rather than one ?
I notice that you have both:
but the second script:
Given that the error checking of the second largely duplicates the work of the first, might it not protect users from a bit of complexity to simply combine the functions of each ?
e.g. with a library function for building / checking arbitrary nests of tags:
// checkedTagTree :: (String, NameNest) -> Tag
const checkedTagTree = nameNest => {
const check = parent =>
([tagName, subTags]) => {
const
namedTag = parent.tagNamed(tagName) || (
new Tag(tagName, parent.ending)
);
return (
// ------ EFFECTS IN OMNIFOCUS -------
// Tag position among peers normalised,
// unless this is a top-level tag.
//
// (The right side of an && expression is
// only evaluated if the left side
// evaluates to true).
(parent !== globalThis) && moveTags(
[namedTag], parent
),
// Descendant tags found or created
// and ordered recursively.
subTags.forEach(check(namedTag)),
// ---- AND VALUE IN JAVASCRIPT -----
// A reference to the checked tag tree.
namedTag
);
};
return check(globalThis)(nameNest);
};
You could avoid error handling with a preliminary check / repair in each tagging script:
writing things like:
const
kanbanTag = checkedTagTree(
["Kanban",
[
["To Do", []],
["In Progress", []],
["Waiting", []],
["Done", []]
]
]
),
todoTag = kanbanTag.tagNamed("To Do"),
peerTags = kanbanTag.flattenedChildren;
Just discovered the Kanban plug-in (v 1.1). It’s wonderful.
Display Board works differently on Mac vs iOS, and I’m wondering if it’s by design or a bug.
On Mac, Display Board shows all 4 Kanban tags by group (as expected).
On iOS, Display Board shows just the To Do tag. Anyone else experience this?