AppleScript: Switching "View" of Sidebar

tl;dr: Nice solution for switching outline views; looking for a solution for switching sidebar views.

I am a total AppleScript newbie, believe me. Like many, I am also:

  • Desperately in need of more accessible switching of views.
  • Astonished there’s no key shortcut for it.

For outline view switching (of tasks, in the middle panel), yes, sandro’s scripts still work. (See this very helpful thread.)

I was able to modify them into blunt instruments to select a single view so that I could put icons in the toolbar (script and screenshot below) and also configure hotkeys using Keyboard Maestro.

I would like to write similar scripts to accomplish sidebar view switching (of projects, in the side panel). After a quick look at the AppleScript dictionary for OmniFocus, I am not able to determine quite what to substitute for set selected task state filter identifier of the content of theDoc to [view].

Can anyone direct me to the right dictionary items?


--	Switch OmniFocus 2 "View" to "All"
--    v0.1
-- 	jhowell@psu.edu
--	Public domain, provided AS-IS
--    Stolen shamelessly from "Cycle Through Task States" http://www.sandro.org/omnifocus/index.php

tell application "OmniFocus"

	set theDoc to document window 1 of document 1

	-- select next task "All"
		set selected task state filter identifier of the content of theDoc to "all"
	-- possible values for "selected task state filter identifier" are:
	--     "next", "available", "incomplete", "all" (also "complete")
	-- in the "Show View Options" list, these values correspond to:
	--     "First Available", "Available", "Remaining", "All" (nothing corresponds to "complete" in that menu)

end tell