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

 
Sum of Estimated Times Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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"
Attached Files
File Type: zip SumTimes.scpt.zip (3.7 KB, 708 views)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Estimated Time of Zero skillet OmniFocus 1 for Mac 2 2012-04-09 01:22 PM
Estimated Time? sirluce OmniFocus for iPad 3 2010-12-03 03:55 AM
Can OF Give Total Estimated Time? klaing OmniFocus 1 for Mac 2 2009-07-22 07:10 PM
Calculated Estimated Time on Projects bjabernethy OmniFocus 1 for Mac 2 2007-05-23 07:13 PM


All times are GMT -8. The time now is 08:02 PM.


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