View Single Post
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 10:24 AM..