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

 
Script: Toggling the status of taskless folders Thread Tools Search this Thread Display Modes
Not sure how widely useful this will be, but I had a reason today to think about toggling the status of folders which contain projects but no tasks (or no available tasks). Toggling them automatically, in other words, back and forth between Active and Dropped.

(One probably needs to set the sidebar filter to All Projects while doing this, to see what's going on)

CAUTION: ILLUSTRATIVE ONLY - NOT RECOMMENDED FOR PRACTICAL USE - THIS MAY TOGGLE BACK INTO LIFE SOME DROPPED FOLDERS WHICH YOU HAD HOPED TO NEVER SEE AGAIN. STUDY IT CAREFULLY AND MAKE SURE THAT YOU UNDERSTAND IT BEFORE YOU THINK OF USING IT.

Not fast (perhaps there is a better way ?) but feasible:

Code:
property pblnHidden : false

-- Toggle the status of folders from which NO TASKS descend
on run
	set pblnHidden to not pblnHidden
	
	tell application id "OFOC"
		tell default document
			repeat with oFolder in (flattened folders where its effectively hidden ≠ pblnHidden) as list
				set refProjects to (a reference to (flattened projects of oFolder where number of tasks > 0))
				if ((count of refProjects) < 1) then set hidden of oFolder to pblnHidden
			end repeat
		end tell
	end tell
end run
or, to toggle the status of folders which enclose no available tasks:

Code:
property pblnHidden : false

-- Toggle the status of folders from which NO TASKS descend
on run
	set pblnHidden to not pblnHidden
	
	tell application id "OFOC"
		tell default document
			repeat with oFolder in (flattened folders where its effectively hidden ≠ pblnHidden) as list
				set refProjects to (a reference to (flattened projects of oFolder where number of available tasks > 0))
				if ((count of refProjects) < 1) then set hidden of oFolder to pblnHidden
			end repeat
		end tell
	end tell
end run

Last edited by RobTrew; 2012-10-01 at 11:24 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggling Status of projects from active to on hold according to time of day smarsh OmniFocus Extras 6 2012-08-07 02:08 PM
Toggling between collapse all and expand all RobTrew OmniFocus Extras 4 2010-06-18 03:53 AM
Key combination for toggling sequential/parallel Toadling OmniFocus 1 for Mac 0 2008-04-30 02:36 PM
Set project status to completed not working in script? dmwatlse OmniFocus Extras 2 2008-04-27 12:10 AM


All times are GMT -8. The time now is 01:43 AM.


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