The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Get total time estimates of selected items (http://forums.omnigroup.com/showthread.php?t=21544)

dbyler 2011-07-06 01:23 PM

Get total time estimates of selected items
 
I just posted a script that calculates and displays the total time estimates of your selected items

[URL="http://bylr.net/3/2011/07/omnifocus-script-get-total-time-of-selected-items/"]Here is[/URL] the script... and [URL="http://bylr.net/3/2011/07/plan-your-day-better-with-omnifocus-time-estimates/"]here is[/URL] how I use it.

Enjoy!

RobTrew 2011-07-07 01:35 AM

[QUOTE=dbyler;99263]I just posted a script that calculates and displays the total time estimates of your selected items[/QUOTE]

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[/CODE]

RobTrew 2011-07-07 03:14 AM

PS

All of this is, of course, a little complicated by the fact that OmniFocus allows us to have a project with an [I]estimated minutes[/I] value of 4m, containing two tasks, each of which have [I]estimated minutes[/I] 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 [I]estimated minutes[/I] 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[/CODE]


All times are GMT -8. The time now is 12:15 PM.

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