The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Toggle State of Context via AppleScript? (http://forums.omnigroup.com/showthread.php?t=21977)

bashosfrog 2011-08-31 04:24 PM

Seeing as you're having so much fun, can the same principle be applied to the Availability filter? I'm forever toggling it between "Remaining" and "Any Status" to look up information in tasks that are completed, and therefore hidden.

Or is there an easier way to achieve this that might have escaped me? A lot escapes me these days.

whpalmer4 2011-08-31 05:37 PM

My database takes so long to switch between views that I try to avoid doing this sort of thing, and so don't take note of what others may have contributed to do it. It does seem to me that someone had posted something similar, but I didn't find it in the first few pages of results in the OmniFocus Extras forum, so I rolled my own. Perhaps someone else remembers what I do not.
[code]
tell application "OmniFocus"
tell front document window of default document
set curTaskState to selected task state filter identifier of content
if (curTaskState is "all") then
set curTaskState to "available"
else
set curTaskState to "all"
end if
set selected task state filter identifier of content to curTaskState
end tell
end tell
[/code]

This script will flip the task status filter for the front document window between Any Status and Available each time it is invoked. If you have some other status displayed, it will switch to Any Status. You could put the script in the toolbar via View→Customize Toolbar... and have one-click access (seems like anything more would be less convenient than just twiddling the view bar setting by hand).

Searching around a bit, perhaps this is what I saw: [url]http://www.sandro.org/omnifocus/index.php#cyclestates[/url]

bashosfrog 2011-08-31 09:36 PM

Your script is just bloody perfect. The toggle is pretty much instant in my DB, which suggests I probably need to do some mindsweeping and fill it up more.

Thanks!


All times are GMT -8. The time now is 12:02 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.