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 Today's Posts

 
Toggling a folder between On Hold and Active Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Discussion in another thread suggests that OmniFocus Ver 2 will allow us to set the status of a Folder to On Hold.

In the meanwhile, here is a draft applescript which toggles the contents and descendants of the selected folder between On Hold and Active (leaving the status of Completed and Dropped projects unchanged).

Code:
-- Ver 0.4
-- Toggles contents and descendants of the selected folder between ON HOLD and ACTIVE
-- The status of any COMPLETED and DROPPED projects is left unchanged
-- Any DROPPED subfolders are also left unchanged

tell application id "com.omnigroup.OmniFocus"
	tell front window
		set lstFolders to value of (selected trees of sidebar where class of value is folder)
		set refProjects to a reference to value of (selected trees of sidebar where ¬
			(class of value is project) and ((status of value is active) or (status of value is on hold)))
	end tell
	
	repeat with oFolder in lstFolders
		my ToggleFolderStatus(oFolder)
	end repeat
	
	set lstStatus to status of refProjects
	if length of lstStatus > 0 then
		if first item of lstStatus is active then
			set status of refProjects to on hold
		else
			set status of refProjects to active
		end if
	end if
end tell

on ToggleFolderStatus(oFolder)
	using terms from application "OmniFocus"
		set refProjects to a reference to (projects of oFolder where (status is active) or (status is on hold))
		set lstStatus to status of refProjects
		if length of lstStatus > 0 then
			if first item of lstStatus is active then
				set status of refProjects to on hold
			else
				set status of refProjects to active
			end if
		end if
		
		set lstFolders to folders of oFolder where hidden is false
		repeat with oSubFolder in lstFolders
			my ToggleFolderStatus(oSubFolder)
		end repeat
	end using terms from
end ToggleFolderStatus
--

Last edited by RobTrew; 2010-05-29 at 12:03 AM.. Reason: Allow for selecting and toggling more than one folder
 
 




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 01:08 PM
Show active and on hold projects with script? mrubenson OmniFocus Extras 3 2012-01-04 11:01 AM
active/on hold/dropped status dloranz OmniFocus 1 for Mac 8 2011-06-22 02:48 PM
Folder 'On Hold' garoda OmniFocus 1 for Mac 9 2008-12-04 04:06 PM
Using 'Waiting' context set to 'On Hold' or 'Active' lilyblossom OmniFocus 1 for Mac 15 2008-08-09 08:34 PM


All times are GMT -8. The time now is 03:29 AM.


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