Any Way to have a quick button to toggle View->Availability


So, I’m using Omnifocus and I have tasks for things like Bills that are due. For example, I would put a task, defer it 2 weeks prior to the due date.

However, sometimes I pay early and before the task appears on my lists.

My work around is to click on the View Button, Change Filter By Availability, Find the item, Click it, and then press the view button and change the filter by availability back.

It would be great if I can have a short cut button to do something like this.

Is something like this available?


I have an AppleScript that is linked to a toolbar icon. I can toggle through available states. See the discussion here.



Thanks @DrJJWMac.

I’m well versed in development, but new to Apple script. I’m trying to understand where the applescript reference for Omnifocus is located.

For example, in your script, this command works:
set selected task state filter identifier of the content of theDoc to "all"
However, the filter by availability dropdown list box still is set for available.

I’m trying to determine what menu option that setting changes.



My script is a modification of the one listed in the link.

jjw revisions
added method to give notification

Cycle through specified state
send feedback to
use at your own peril 

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.

--a list of context names you want selected.  
-- possible options, any combination of:"all","next", "available", "incomplete","complete"
property pCycleList : {"all", "incomplete", "available", "next"}
property pShowNotification : false -- set to true to give notification of state

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

set theDoc to document window 1 of document 1

-- set the cycle list
set availableTaskStates to pCycleList

-- 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

if pShowNotification then
	set theFilter to item nextTaskState of availableTaskStates as text
	display notification theFilter with title "Omnifocus"
	delay 0.1 --> allow time for the notification to trigger
end if
end tell

It is installed as per the instructions to install AppleScripts to run from the toolbar to OmniFocus. Mine resides in the toolbar with the icon on the far left.

I click on the icon and the visibility of tasks cycles through the set of options in pCycleList.



Hi there, I used to love this script with OF2. Any way to update it for OF3?


I have no issues with using the script in OF3. I don’t use the ShowNotification part of the script though.



Thank you very much. I can confirm that this works in latest omnifocus 3.
This should really be build in as a menu with keyboard short cut and a tool icon.

My only adjustment is to only toggle between remaining/available:

-- property pCycleList : {"all", "incomplete", "available", "next"}
property pCycleList : {"incomplete", "available"}

But thank you for listing all states, this might be useful if I want another keyboard shortcut to toggle to all/next.

Btw, I use BetterTouchTools, it allows easy assignment of application specific keyboard shortcuts. Although I imagine the same thing is probably doable via other means.