How would I show or hide the sidebar when opening a new window in a script? Thanks.
Couldn’t figure it out myself, so I cheated with System Events:
tell application "OmniFocus" to activate
tell application "System Events"
keystroke "s" using command down & option down
end tell
2 Likes
Nice work around. Thanks.
1 Like
Your question encouraged me to begin working out something I’ve wanted to do: open my daily planning routine in OmniFocus. I welcome improvement to the script, but it does the following:
- Opens my Dashboard perspective (inspired by Kourosh Dini here).
- Opens my Planning perspective (inspired by Sven Fechner here).
- Closes the Sidebar and Inspector panels in the Planning perspective.
I then use keyboard shortcuts (via BetterTouchTool) to shunt the Planning perspective window to the right of my screen and flag items to accomplish today. After closing that window I have Dashboard visible and I’ll work from it for the day’s tasks.
tell application "OmniFocus"
tell default document
make new document window with properties {perspective name:"Dashboard"}
tell application "OmniFocus" to activate
make new document window with properties {perspective name:"Planning"}
delay 3
tell application "System Events"
keystroke "s" using command down & option down
keystroke "i" using command down & option down
end tell
activate "OmniFocus"
end tell
end tell
1 Like
To make the window even more clean, I want to hide/show toolbar at the same time. I added following script to achieve the goal. For any one interested:
try
click menu item "Hide Toolbar" of menu "View" of menu bar item "View" of menu bar 1
on error
click menu item "Show Toolbar" of menu "View" of menu bar item "View" of menu bar 1
end try