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

 
Does context totaler script exits? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Good - I'm glad that meets the need.

Tidied up a little here for legibility, in case you need to adjust it.

(Forum settings no longer permit updating earlier posts)

Code:
property pTitle : "Remaining task counts for contexts"
property pVer : "0.04"
property pPrefix : "@"
property pDelim : "  "
property pIndent : tab

property pblnToClipboard : true
property pblnSubTreeCounts : true

on run
	tell application id "OFOC" to set {str, lngTotal} to my ListContexts(contexts of default document, "")
	set str to str & linefeed & "TOTAL: " & lngTotal as string
	
	if pblnToClipboard then set the clipboard to str
	display dialog str buttons {"OK"} default button "OK" with title pTitle & "  ver. " & pVer
end run

on ListContexts(lstContexts, strIndent)
	set {str, lngCount, lngTotal} to {"", 0, 0}
	tell application id "OFOC"
		repeat with oContext in lstContexts
			tell oContext
				-- COUNT AND REPORT FOR SUB-TREE
				set {strSub, lngSub} to my ListContexts(contexts, strIndent & pIndent)
				
				-- COUNT ASSIGNMENTS TO THIS LEVEL (SUBTRACTING SUBTREE ASSIGNMENTS)
				set lngCount to remaining task count
				set lngThisLevel to lngCount - lngSub
				
				-- REPORT ON THIS LEVEL, APPENDING SUB-TREE REPORT
				set strSubTotal to ""
				if (pblnSubTreeCounts and (lngSub > 0)) then set strSubTotal to "  (+" & (lngSub as string) & " in sub contexts)"
				set str to (str & strIndent & pPrefix & its name & pDelim & lngThisLevel as string) & strSubTotal & linefeed & strSub
			end tell
			
			-- AND KEEP A RUNNING TALLY FOR REPORTING TO THE LEVEL ABOVE
			set lngTotal to lngTotal + lngCount
		end repeat
		return {str, lngTotal}
	end tell
end ListContexts
 
 





All times are GMT -8. The time now is 09:19 PM.


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