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

 
Get total time estimates of selected items Thread Tools Search this Thread Display Modes
I just posted a script that calculates and displays the total time estimates of your selected items

Here is the script... and here is how I use it.

Enjoy!
 
Quote:
Originally Posted by dbyler View Post
I just posted a script that calculates and displays the total time estimates of your selected items
Good !

FWIW you may be able to simplify (and slightly accelerate) your central counting process by gathering all the selected tree values in a single Apple Event.

Code:
set {Hrs, Mins, itemCount} to SelectedMins()

display alert (Hrs as string) & "h " & (Mins as string) & "m total for " & (itemCount as string) & " items"

on SelectedMins()
	tell application "OmniFocus"
		tell content of front document window of front document
			set lngMins to 0
			set lstValues to value of (selected trees where class of its value is not item and class of its value is not folder)
			repeat with oValue in lstValues
				set varMins to estimated minutes of oValue
				if varMins is not missing value then set lngMins to lngMins + varMins
			end repeat
			return {lngMins div 60, lngMins mod 60, count of lstValues}
		end tell
	end tell
end SelectedMins

Last edited by RobTrew; 2011-07-07 at 02:31 AM..
 
PS

All of this is, of course, a little complicated by the fact that OmniFocus allows us to have a project with an estimated minutes value of 4m, containing two tasks, each of which have estimated minutes values of 1h 30m ...

(No automatic summing is done)

So if we select both this swiftly executed project, and its time-consuming component parts, the interpretation of the results is left to us ...

For a quick glimpse of the size of the mountain ahead of us, counting, for simplicity of interpretation, only the estimated minutes of tasks, and ignoring task groups and projects, (and reporting the total number of tasks that have estimates) we could write:

Code:
set {Hrs, Mins, timedItems} to TotalMins()

display alert (Hrs as string) & "h " & (Mins as string) & "m total for " & (timedItems as string) & " tasks with estimated times"

on TotalMins()
	set {dlm, my text item delimiters} to {my text item delimiters, "|"}
	set {strMins, strItems} to text items of (do shell script "OFOC=$(osascript -e 'tell application \"Finder\" to get id of application file id \"OFOC\"');
		sqlite3 ~/Library/Caches/$OFOC/OmniFocusDatabase2 '
		SELECT sum(estimatedMinutes), count(estimatedMinutes) 
		FROM task WHERE projectInfo is null and childrenCount=0 and dateCompleted is null'")
	set my text item delimiters to dlm
	set lngMins to strMins as integer
	return {lngMins div 60, lngMins mod 60, strItems as integer}
end TotalMins
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total Remaining Time? commmmodo OmniFocus Extras 3 2011-12-29 11:06 AM
Time estimates aalsdorf OmniFocus for iPad 5 2011-11-26 07:11 PM
Time estimates on iPad? montbarron OmniFocus for iPad 4 2011-05-30 04:19 PM
Sum up of time estimates for actions in project hagbard5235 OmniFocus 1 for Mac 2 2010-02-13 10:34 AM
Feature Requests: Total Time Young Daniel OmniFocus 1 for Mac 4 2007-10-13 12:51 PM


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


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