Hello,
I find it quite tedious to switch between the display of remaining, available, and all tasks with the mouse, I’d rather like to use a shortcut. But as there is no menu entry for this, I cannot create a shortcut via Mac’s System Control.
Is there another way to achieve this goal?
Any help would be appreciated.
Thanks
Alex
The AppleScript below will cycle states from All, Incomplete, Available, and Next. Modify as needed.
(*
jjw revisions
added method to give notification
Cycle through specified state
v0.2
send feedback to sandro@sandro.org
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.
*)
--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
try
-- select next task state
set selected task state filter identifier of the content of theDoc to item nextTaskState of availableTaskStates as text
on error
return
end try
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
–
JJW
2 Likes