Launch Omnifocus Perspective with Keyboard Maestro

I’d like to create a Keyboard Maestro script to launch Omnifocus and jump right to my morning routine. I would also like to turn off the side bar and inspector (to remove all distractions). Here’s the script I created:

49%20AM

It launches Omnifocus but I get this error:

How can I fix this error?

Also, is there a better way to script a menu item that toggles. I want the script to turn off the side bar and inspector in Omnifocus but the menu command changes based on whether these items are visible resulting in the script showing these items rather than turning them on.

Thank you in advance.

Before the Select menu step, add a Pause until... menu is enabled step.

Thank you @eurobubba.

Ooops... @eurobubba. I thought it worked but the OmniFocus window is just opening up in the same perspective and screen location as when it was last left open. The macro also continues to run and I need to cancel it using the menu. Here's what I have:

Did I use "Pause Until..." correctly?

Like this (but using your perspective name, of course).

To switch to a perspective, I use the Open URL command like this.

13%20AM

It is URL-encoded. Make sure to keep the casing exactly the same.

House is different from house.

You'll also have to convert characters that are not alphabet letters and numbers. A space would be converted to %20. So my "Big Rocks" perspective URL would be

omnifocus:///perspective/Big%20Rocks

Thank you @Wilson_Ng. The URL worked well. I am trying to open up other files and applications in the same script then place their windows in certain locations. Here's the script:

But I am getting this error:

The "Pause Until..." that @eurobubba suggested above worked but not sure what type of pause I should use when opening up multiple applications/files.

Another question @Wilson_Ng: can I use a Macro to always hide the OF Sidebar and Inspector? Unfortunately using the KM "Show or Select Menu Item" action doesn't work because the OF Show/Hide Sidebar (or Inspector) menu item changes based on its current state.

Thanks in advance.

Click on the gear icon (#1)

Then go to #2 and uncheck Failure aborts Macro and `Notify on Failure1

This part will tell KM to ignore any failure and continue on to the next step.

1 Like

what happens if you change the setting in move and resize window?
Instead of "the front window", try "the window with title" and type in the name of your Pages document?

I don't know if it's necessary but maybe have a conditional to pause until Window "XXX" exists and then proceed to resize?

I might be overdoing it but when I manipulate windows during debugging, I throw in the "active application" to bring it to the forefront. It helps me to see if the macro is doing what I want it to do.

1 Like

Brilliant! Thank you @Wilson_Ng.

I've got another one: I'd like create a Macro to go to my Projects perspective with all of the folders collapsed. I can't figure out a way to collapse the entire Project list in KM since I need to first select a project name before Collapse All shows up in the OF View menu. Does that make sense?

Here is what I have...

Turn off the failure aborts in the gear setting for the Select menu items that I circled.

1 Like

You're blowing my mind :wink: Thank you...I'm on my way.

1 Like

Serendipity today. I don't normally visit the KM forums. Just happened to be here looking for something else.

I'm usually at the Guild which you already asked a question.

Cheers!

I really appreciate the insight; it's helped break some productivity logjams. I plan to return to the Guild....looks like my kinda people.

1 Like