View Single Post
Here's a "clean up" script:
Code:
tell application "OmniFocus"
	compact default document
end tell
I believe we support UI scripting via the method discussed on this page, but my brief experimentation failed to yield a working example. This is hopefully a failure of the scripter, and not the app. :-)

Instead, here's one that uses a different approach: it triggers the "Expand all" command by simulating the keyboard shortcut:

Code:
tell application "System Events"
	tell process "OmniFocus"
		keystroke "9" using {command down, control down}
	end tell
end tell
The Alphabet-sort of the project list would be a bit trickier, as it's not susceptible to the fake-keyboard-events approach; there's no keyboard shortcut for the "sort by" options in the Edit menu.

Lemme chew on that one for a bit. Possibly including asking one of the engineers about it next time I bump into them in the lunch line. ;-)