View Single Post
FWIW updating this because I find I am using a much simpler script these days.

This toggles the selected subtree between sequential and parallel.

If the selection is a twig (rather than an action group or project), the immediate parent and all its descendants are all toggled to the same state.

If the selection is a parent (i.e. a project or a action group), then it and all its descendants are toggled to a uniform state.

Code:
tell application id "OFOC"
	tell front document window of front document
		set refTrees to a reference to (selected trees of content where class of its value is task or class of its value is project)
		if (count of refTrees) < 1 then set refTrees to a reference to (selected trees of sidebar where class of its value is project)
	end tell
	
	tell (value of refTrees) as list
		if (count) < 1 then return
		tell first item
			if (class ≠ project) and (count of its tasks) < 1 then
				set oParent to container
			else
				set oParent to it
			end if
		end tell
	end tell
	
	tell oParent
		set sequential to not (sequential)
		set sequential of flattened tasks to sequential
	end tell
end tell
--

Last edited by RobTrew; 2011-04-07 at 07:17 AM.. Reason: Slight rearrangement of the code for simpler reading