Automation bug with URL.open()?

Just upgraded to OF4. Will also report this to the right channel, but putting here in case folks have encountered and solved this before.

When I navigate to a project using URL.open(), it sometimes works. Here is a case when it regularly fails. What happens is that I see the project selected in the side panel but nothing shows up in the main outline panel.

document.windows[0].perspective = Perspective.BuiltIn.Tags
document.windows[0].perspective = Perspective.BuiltIn.Projects
URL.fromString(“omnifocus:///task/” + flattenedProjects.byName(“foo”).id.primaryKey).open()

At this point, the outline panel is in some funky state and clicking on any project in the sidebar still keeps it empty. But if I change the perspective with a mouse and come back, all is well again.

It may be you need to wait within your code a little after you have changed perspectives. I think I read something about that, but I could be mistaken.

Thanks, @Logan !

I was about to try what you said on a different mac, and curiously, I don’t seem to be getting the error there, but still getting it on the origonal mac.

No problem on: MacOS 13.4, OmniFocus Pro 4.05
Problem on: MacOS 14.4: OmniFocus Pro 4.05