View Single Post
If you are running OF 1.8, this toggling version is a little faster:

Code:
-- Ver 0.9 (OF 1.8 only)
-- Toggles status of contents and descendants of the selected folder(s) and project(s) between ON HOLD and ACTIVE

-- The status of any COMPLETED and DROPPED projects is left unchanged
-- Any DROPPED subfolders are also left unchanged

property pActive : "Active"
property pOnHold : "On Hold"

tell application id "com.omnigroup.OmniFocus"
	tell front window
		set oPanel to sidebar
		if (count of selected trees of oPanel) < 1 then
			set oPanel to content
			set lstFolders to {}
		else
			set lstFolders to value of (selected trees of oPanel where ¬
				(class of value is folder) and (hidden of value is false))
		end if
		set refProjects to a reference to value of (selected trees of oPanel where ¬
			(class of value is project) and ((status of value is active) or (status of value is on hold)))
	end tell
	
	-- Find the first project in (or contained by) the selection
	set oProj to missing value
	set lstProjects to contents of refProjects
	if length of lstProjects > 0 then
		set oProj to first item of lstProjects
	else
		repeat with oFolder in lstFolders
			set lstProj to (flattened projects of oFolder where ((status is active) or (status is on hold)) and (hidden of its folder is false or its folder is missing value))
			if length of lstProj > 0 then
				set oProj to first item of lstProj
				exit repeat
			end if
		end repeat
	end if
	if oProj is missing value then return
	
	-- Determine the next toggle direction
	status of oProj
	if status of oProj is active then
		set eNewStatus to on hold
	else
		set eNewStatus to active
	end if
	
	-- and set the new status
	set status of refProjects to eNewStatus
	repeat with oFolder in lstFolders
		set (status of flattened projects of oFolder where ((status is active) or (status is on hold)) and (hidden of its folder is false)) to eNewStatus
	end repeat
end tell
--

Last edited by RobTrew; 2010-08-20 at 03:20 AM..