Hi All,
Thanks to the previous expertise displayed in these forums, I've cobbled together an applescript to sum up the estimated times of the actions for a given project. Of course, it would be nice to associate this script with the cell for estimated time for a given project (so that it would sum up the times of the child actions), but for now, at least, if you select some actions, it will sum the estimated times, display the result in Growl, and also put the result on the clipboard (so you can paste it into the overall project estimated time cell).
As you can see, I said "cobbled" above because I relied entirely on the great work of RobTrew and a11en in other threads.
If anyone knows how to more automagically associate this with the cells of the projects which own the actions so more directly do something like inserting =sum() into the estimated time cell for a project, I'd love to hear about it!
And of course, improvements, changes, etc.. are very welcome!
I'm including the script as an attachment and am also just pasting in the text.
Thanks again to you all!
Jake
Here it is:
Code:
-- Sum estimated times, display sum in Growl and copy sum to clipboard (for later pasting back into estimated time for an entire project, or elsewhere).
-- Jake Bowers (jwb1970@gmail.com), 2008-24-10
-- largely based on RobTrew's StartTimer.scpt Ver 0.02 for code to adds up durations of selected tasks (http://forums.omnigroup.com/showthread.php?t=4748)
-- and on hint from a11en in thread Minuteur Applescript for Growl Notification. (http://forums.omnigroup.com/showthread.php?t=6749)
tell application "OmniFocus"
tell front document
tell document window 1
set oTrees to selected trees of content
set lngTrees to count of oTrees
if lngTrees > 0 then
set lngTotal to 0
repeat with iTree from 1 to lngTrees
set oTask to value of (item iTree of oTrees)
set lngMinutes to estimated minutes of oTask
-- set lngMinutes to 0 if duration is empty
try
lngMinutes
on error
set lngMinutes to 0
end try
set lngTotal to lngTotal + lngMinutes
--do shell script "/usr/local/bin/growlnotify OmniFocus -m 'Total time " & lngTotal & " minutes' -p 1"
end repeat
end if
end tell
end tell
set the clipboard to (lngTotal / 60) as rich text
--set the clipboard to (the clipboard) & return & lngTotal
end tell
do shell script "/usr/local/bin/growlnotify OmniFocus -m 'Total time " & (lngTotal / 60) & " hours' -p 1"