Navigating OmniFocus with Keyboard Maestro and AppleScript

Since I am working from home for the foreseeable future, it’s stabilised my working environment. This means a little more time for automation! I wrote a Keyboard Maestro macro to help me navigate around OmniFocus (sort of). I’m posting here as it based on AppleScript.

A lot of my work is facilitating workshops and I often have several on the go at one time. I wanted a way to see a list of my active ‘engagements’, select one and then go right to it in OmniFocus.

Here it is:

Screen Shot 2020-03-20 at 6.14.25 am

This first step looks in my “Engagements” folder in OmniFocus and extracts the list of Projects. I couldn’t work out how to use a whose clause to give me only the Projects whose status is active and that’s why I went with the loop and if clause. Any thoughts on this is appreciated!

This returns a list of the active projects separated with commas. The next steps:

Screen Shot 2020-03-20 at 6.16.52 am

Replace the commas with newlines and then prompts me with the list of active projects. Once I’ve selected the project hat is saved into the variable ofSelectedEngagement.

The next step is to get the task id of the project I selected:

Screen Shot 2020-03-20 at 6.18.35 am

The first bit of that script gets the Keyboard Maestro variable into an AppleScript variable. The next bit finds the task id of the project. There is a potential issue here if I have two projects with the same name.

The final step is to open the project in OmniFocus:

Screen Shot 2020-03-20 at 6.20.53 am

This uses the same syntax as what gets created if you choose ‘Copy as Link’ in OmniFocus.

I trigger the above with a button on an Elgato Stream Deck.

1 Like

Any reason you’re not using ‘choose from list’ in the first script and skipping the KM variable and list prompt?

Only that I didn’t know about it! :crazy_face:

That said, having looked at them both, I think the Keyboard Maestro picker looks nicer.

I’ve made an addition to the above macro.

I usually create the project via a Shortcut which also creates a project in Agenda with the same name.

I’ve now added the following to the macro

Screen Shot 2020-03-25 at 8.27.10 am

which will open the Agenda project too.

This is working great for me!