In OmniFocus, there are a handful of tags that I use regularly, and I’d love to use Keyboard Maestro to assign separate keyboard shortcuts for toggling each of about 10 tags (adding or removing them). This function is built in for the “Forecast” tag with ⌃⌘-L (which is fantastic), but I’d like to have this for more of my regularly-used tags.
Ideally, this would also allow one to apply this to multiple selections. I’m guessing that a witch’s brew of “repeat” and “if - else” operations would do the job, but I’m too new to AppleScript to get it to work. Anyone already done this or have ideas how to do it?
I don’t use OmniFocus, but from the script above you can see that you use ‘theTask’, but haven’t defined what it is in OmniFocus.
Looking at this, it would suggest that you need to specify it with maybe something like this:
tell application "OmniFocus"
tell front window
set my_sel to selected trees of content
set theTask to value of item 1 of my_sel
Now the article I referenced above is quite old, and I’m sure OF3 potentially has lots of new ways of doing things; maybe including this. Because I’m not an OF user I can’t test it, but I strongly suspect that you need to have something like this to do the specification of what the variable ‘theTask’ represents.
Thanks for this. Terrific work. The option of picking tags to toggle is great, but what I’m looking for is speed, so I’d prefer to make individual scripts for individual tags, without the intermediary step. It shouldn’t be too hard for me to just eliminate the selection steps, but if you have a stripped down version as well (say, for just toggling “Today”), I’d be much obliged!
It’s not obvious, but if you put in the script just a list of one item it won’t bring up the list picker. You can just duplicate the script with different single tag lists and assign to different hot keys to do it for single tags.