Script to open perspectives in tabs


#1

I’ve searched this forum but haven’t found a way to do this for Omnifocus 3 (3.2.1). I have built an Automator workflow that opens a bunch of apps I use every day, including OF3. I’d love to start with a couple of specific perspectives side by side in tabs. I am hoping I can do this with AppleScript.

I see these two scripts, but nothing about tabs:

tell application "OmniFocus"
	tell the default document to tell the front document window
		set perspective name to "Projects"
		activate "OmniFocus"
	end tell
end tell

tell application "OmniFocus"
	tell default document
		make new document window with properties {perspective name:"Review"}
		activate "OmniFocus"
	end tell
end tell

Anyone know how to do this? I’m using OS 10.14 Mojave. Thanks for any help!


#2

Well, here’s one way I discovered! After I open the additional windows (see original post), I can run this:

tell application "System Events"
    tell process "OmniFocus"
          click menu item "Merge All Windows" of menu "Window" of menu bar 1
     end tell
end tell

But you need to make sure the app you’re running this from (inside Script Editor, for example, while you’re testing it) has Assistive access (Under System Preferences > Security & Privacy > Accessibility or it’ll generate an error.


#3

I had to use Keyboard Maestro to do this for me. KM is $29 but I am surprised how much more I’ve gotten out of a software package that I thought would be a one trick pony.


#4

Thanks. I did it without KM, but I will take a look at it.


#5

yay! that’s great that you were able to do it AppleScript alone. I wanted to bind the macro to a keyboard shortcut. I’m guessing you could go to System Preferences > Keyboard and assign it a shortcut key to the AppleScript so that should do the trick to activate it.


#6

I love the idea to have multiple Perspectives open at once