The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Toggle State of Context via AppleScript? Thread Tools Search this Thread Display Modes
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.
 
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
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: http://www.sandro.org/omnifocus/index.php#cyclestates
 
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!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Omnifocus/applescript issue when setting context greeno OmniFocus 1 for Mac 3 2012-07-10 04:32 AM
Need basic applescript for changing context tah OmniFocus Extras 8 2009-07-30 01:51 PM
Applescript Snippet Request: Get Tasks for Context kenclark OmniFocus Extras 2 2009-02-12 03:46 AM
AppleScript to add tasks in a particular context to iCal for notifications dmcg OmniFocus Extras 0 2009-01-08 04:20 PM
Applescript example: listing by context RobTrew OmniFocus Extras 0 2007-08-21 02:31 AM


All times are GMT -8. The time now is 11:50 AM.


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