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

 
Toggling between collapse all and expand all Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
A draft applescript to toggle between collapsing and expanding all project tasks and sub-tasks.

Mainly illustrative - it works if run from the script menu, but its practical utility is limited by the fact that, (at least as of OF build 98016) static variables like blnNewState below lose their state between runs if the script is run from the OF toolbar.

Thus, if used from the toolbar, the script provides only a Collapse All function, whereas if run from the script menu, it alternately functions as Collapse All or Expand All, switching every time it is run.

Code:
tell application "OmniFocus"
	global blnNewState
	
	try
		blnNewState
		set blnNewState to not blnNewState
	on error
		set blnNewState to false
	end try
	
	tell content of window 1
		
		set oTrees to trees
		
		repeat with oTree in oTrees
			my Expand(oTree, blnNewState)
		end repeat
	end tell
end tell


on Expand(oTree, blnNewState)
	using terms from application "OmniFocus"
		set oSubTrees to trees of oTree
		
		if (count of oSubTrees) > 0 then
			set expanded of oTree to blnNewState
			repeat with oSubTree in oSubTrees
				Expand(oSubTree, blnNewState)
			end repeat
		end if
	end using terms from
end Expand

Last edited by RobTrew; 2008-02-27 at 02:30 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expand/Collapse All Joseph OmniGraffle General 2 2012-06-21 05:37 PM
OF 1.2 Expand/Collapse all atreinke OmniFocus for iPad 2 2010-11-13 05:06 AM
Expand a little, collapse a little ... RobTrew OmniOutliner 3 for Mac 0 2010-11-04 04:01 AM
Collapse or expand one section only? rogbar OmniOutliner 3 for Mac 1 2009-01-28 03:06 PM
Expand/collapse notes? marieboyer OmniFocus 1 for Mac 2 2008-08-09 09:29 AM


All times are GMT -8. The time now is 11:32 PM.


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