Applescript -> Toggle view Available/Remaining projects?

Because I am lazy and find that three clicks and a mouse drag is intolerable for frequent interface actions, I’m curious if there exists an AppleScript that will toggle the current view between:

  • View Available projects
  • View Remaining projects

(That is, replicable the functionality of clicking the View toolbar button, clicking the corresponding radio button, closing it.)

Lazy thanks!


This script does the trick (from

--	Cycle through specified state
--    v0.2
-- 	send feedback to
--	use at your own peril 

-- changes:
-- 0.3: removed activate command which all of a sudden no longer works
-- 0.2: removed flagged as a possible state now that it's in its own filter.

-- bring OmniFocus to the front
tell application "OmniFocus"

set theDoc to document window 1 of document 1

-- get and set needed task states
--a list of context names you want selected.  
-- possible options, any combination of:"all","next", "available", "incomplete","complete"
-- this script will cycle through these states in the order that they are displayed below, so feel free to re-order them to your liking
-- BTW: incomplete = remaining if it wasn't apparent already
set availableTaskStates to {"next", "available", "incomplete"}

-- get current state
set currentTaskState to selected task state filter identifier of the content of theDoc as text

-- init next state
set nextTaskState to ""

-- get count of total number of available task states in "array"
set numberAvailableTaskStates to count (availableTaskStates)

-- identify if current state is in "array"
repeat with i from 1 to numberAvailableTaskStates
	-- check to see if current state is last one in "array" and select first state, or select next available state
	if currentTaskState is equal to item numberAvailableTaskStates of availableTaskStates as text then
		set nextTaskState to 1
		exit repeat
	else if currentTaskState is equal to item i of availableTaskStates as text then
		set nextTaskState to i + 1
		exit repeat
	end if
end repeat

-- current task state wasn't in array so just go to the first item
if nextTaskState is equal to "" then
	set nextTaskState to 1
end if

-- select next task state
set selected task state filter identifier of the content of theDoc to item nextTaskState of availableTaskStates as text

end tell
1 Like

Thanks for the response!

If I’m not mistaken, this script operates on tasks. What I’m looking for a script that will operate on projects. (See attached image for the option in question.)

The script toggles between the preferences in the circle.

If you want to see remaining projects, use individual configured perspectives.

1 Like

This is fantastic and almost exactly what I was looking for. It doesn’t seem to update those radial buttons in view in OmniFocus 3 (not sure if it did in version 2). I don’t ever seem to get All or First Available. I ideally would like to have a macro that I can assign a key command to all four of those views (First Available, Available, Remaining, and All) if that is possible do you know if it is in OmniFocus 3?

I just found the AppleScripts here, thanks Switching views (available / remaining) via Hotkey / Scripting in Omnifocus