Cycling through available task filter states


In OF2 for Mac I have used an AppleScript to cycle through the task filter states “available”, “incomplete”, “complete” in any perspective, using the selected task state filter identifier variable. In OF3, that only seems to work in the Tags tab, but not in Perspective tabs.

If I run this command when the Tags tab is selected:

tell application "OmniFocus"
set theDoc to document window 1 of document 1
get available task state filter identifiers of the content of theDoc
end tell

the output is

{"next", "available", "incomplete", "all", "complete"}

When a perspective is selected, the only option returned is {"all"}, even though I can still change the filtering manually using the “Filter by Availability” menu.

Is this the expected behavior? Is there some way to work around this in AppleScript? Thanks in advance for the help.

Toggle Availability via Shortcut or Script?

It looks like in OF3 get available task state filter identifiers only works for the built-in perspectives (e.g., Projects, Tags, Forecast, Review, Inbox), but not for custom perspectives. For custom perspectives, it always just returns “all”, as you already wrote, and, as a consequence, setting selected task state filter identifier to for instance “available” no longer works for custom perspectives.

This definitely looks like a bug to me. It is a particularly unfortunate regression because switching task state filters via keyboard shortcuts is extremely useful, especially because the built-in way is so cumbersome (you have to reach for the mouse, click a button, move the mouse cursor down half the screen, click on a pop-up menu, and then select the desired state from a list).

If anyone has an idea for a workaround, I would be very grateful, too. In the meantime, I have submitted a bug report about the issue.