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

 
Return all tasks that are nested under a folder? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Just been asked this in a private message. Public discussion spreads the load and brings better harvests, so here's a first seedling.

Code:
tell application id "OFOC"
	tell default document
		-- SOME FOLDER, LET'S JUST GRAB THE FIRST WE SEE ...
		set oFolder to first folder
		
		-- ALL ACTIVE CHILD-BEARING PROJECTS ENCLOSED BY THIS FOLDER, REGARDLESS OF NESTING
		set refProjects to a reference to (flattened projects of oFolder where number of tasks > 0 and status is active)
		
		-- HARVEST THE PROGENY THEREOF (PERHAPS FILTERED) AS A LIST OF LISTS
		set lstTasks to flattened tasks of refProjects where completed is false
		
		-- FLATTEN THE LIST, IF NEED BE
		set lstTasks to my FlatList(lstTasks)
	end tell
end tell


on FlatList(lst)
	if class of lst is not list then
		{lst}
	else if lst ≠ {} then
		FlatList(item 1 of lst) & (FlatList(rest of lst))
	else
		{}
	end if
end FlatList
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
nested tasks in forecast mavric OmniFocus 1 for Mac 2 2013-01-29 03:34 PM
When to use nested tasks? Derekasaurus Applying OmniFocus 2 2011-03-14 07:26 AM
EMail folder dedicated for tasks JackTB Applying OmniFocus 0 2010-06-25 10:33 AM
Nested tasks don't inherit due dates enricofra OmniFocus 1 for Mac 4 2008-03-26 09:39 AM
hitting return with a folder selected... seebs OmniFocus 1 for Mac 4 2007-09-25 07:11 AM


All times are GMT -8. The time now is 01:37 PM.


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