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
Cool. Thanks. I will integrate it into OmniFocus directly.
 
Hey, thanks for making this. I was wondering if there's a way to have the script automatically in the project's estimated time.
 
Thanks for the great script. I've been looking for something just like this. I modified the script slightly to change the output back to an improved Growl Notification. There are still two modifications I'd like to make:

1. Automatically insert the estimate time into the project or group.
2. In a project with several groups, I would like the script to calculate the estimated time for the project based on the group estimated times and not the group plus action estimated times. Currently, if you run the script on a group, then run the script on a whole project, it will return a result that is twice your intended result.

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)
-- James O'Leary (jpo@me.com), 2008-08-11 
-- now can handle context view "boxes) (assigned an estimated time of 0) and the time displayed is in hours and minutes instead of
-- just a straight up hours number. Displays in dialog box now instead of copying to clipboard. Item count displayed as well.
-- Aaron Hunyady (aaron@hunyady.net), 2009-08-01
-- Removed "cancel" button in dialog. Total time in minutes is copied to the clipboard.
-- Ben Davidson (benjamin@idavidson.ca), 20009-05-02
-- Updated the Growl notification feature and removed the dialogue box (you need to install the Growl extra, "growlnotify" - included in the install disk image)
-- Changed some of the dialog wording
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)
					
					
					try
						set lngMinutes to estimated minutes of oTask
					on error
						set lngMinutes to 0
					end try
					
					if lngMinutes as string is equal to "missing value" then
						set lngMinutes to 0
					end if
					
					
					set lngTotal to lngTotal + lngMinutes
					
				end repeat
			end if
			set the clipboard to lngTotal as rich text
			-- do shell script "/usr/local/bin/growlnotify OmniFocus  -m 'Total time " & lngTotal & " minutes' -p 1"
		end tell
	end tell
	set lngHours to 0
	repeat
		if lngTotal < 60 then exit repeat
		set lngTotal to lngTotal - 60
		set lngHours to lngHours + 1
	end repeat
end tell
if lngHours = 1 then
	set strPluralHours to " hour "
else
	set strPluralHours to " hours "
end if
if lngMinutes = 1 then
	set strPluralMinutes to " minute"
else
	set strPluralMinutes to " minutes"
end if
if lngTrees = 1 then
	set strPluralTasks to "task"
else
	set strPluralTasks to "tasks"
end if

do shell script "/usr/local/bin/growlnotify Estimated Project Time -a OmniFocus -m ' " & lngTrees & " " & strPluralTasks & "
 " & (lngHours) & "" & strPluralHours & "and " & lngTotal & "" & strPluralMinutes & "' "
 
Updated version allows customization for use of growl or dialog box, and gracefully handles case where growl not present. Also warns if there are tasks in the selection which do not have duration estimates.

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)
-- James O'Leary (jpo@me.com), 2008-08-11 
-- now can handle context view "boxes) (assigned an estimated time of 0) and the time displayed is in hours and minutes instead of
-- just a straight up hours number. Displays in dialog box now instead of copying to clipboard. Item count displayed as well.
-- Aaron Hunyady (aaron@hunyady.net), 2009-08-01
-- Removed "cancel" button in dialog. Total time in minutes is copied to the clipboard.
-- Ben Davidson (benjamin@idavidson.ca), 20009-05-02
-- Updated the Growl notification feature and removed the dialogue box (you need to install the Growl extra, "growlnotify" - included in the install disk image)
-- Changed some of the dialog wording
-- Bill Palmer, 2011-01-30
-- Control use of growl vs. dialog box with useGrowlPref property, gracefully handle case where growlnotify not installed.
-- Also warn if any of the included tasks did not have a duration estimate

property useGrowl : false -- set this to false if you don't (want to) use Growl
property growlNotifyPath : "/usr/local/bin/growlnotify" -- default location for growlnotify installation

tell application "OmniFocus"
	tell front document
		tell document window 1
			set oTrees to selected trees of content
			set lngTrees to count of oTrees
			set underEstimate to ""
			
			if lngTrees > 0 then
				set lngTotal to 0
				repeat with iTree from 1 to lngTrees
					set oTask to value of (item iTree of oTrees)
					
					
					try
						set lngMinutes to estimated minutes of oTask
					on error
						set lngMinutes to 0
					end try
					
					if lngMinutes as string is equal to "missing value" then
						set lngMinutes to 0
						set underEstimate to "
Warning: a task had no estimated duration!"
					end if
					
					
					set lngTotal to lngTotal + lngMinutes
					
				end repeat
			end if
			set the clipboard to lngTotal as rich text
		end tell
	end tell
	set lngHours to 0
	repeat
		if lngTotal < 60 then exit repeat
		set lngTotal to lngTotal - 60
		set lngHours to lngHours + 1
	end repeat
end tell
if lngHours = 1 then
	set strPluralHours to " hour "
else
	set strPluralHours to " hours "
end if
if lngMinutes = 1 then
	set strPluralMinutes to " minute"
else
	set strPluralMinutes to " minutes"
end if
if lngTrees = 1 then
	set strPluralTasks to "task"
else
	set strPluralTasks to "tasks"
end if

if useGrowl then
	set fp to (POSIX file growlNotifyPath)
	tell application "Finder"
		if not (exists fp) then
			set useGrowl to false
		end if
	end tell
end if

if useGrowl then
	do shell script growlNotifyPath & " Estimated Project Time -a OmniFocus -m ' " & lngTrees & " " & strPluralTasks & "
 " & (lngHours) & "" & strPluralHours & "and " & lngTotal & "" & strPluralMinutes & underEstimate & "' "
else
	display dialog "Item count: " & lngTrees & "
" & "Total time: " & (lngHours) & strPluralHours & lngTotal & strPluralMinutes & underEstimate buttons {"OK"} default button 1
end if

Last edited by whpalmer4; 2011-01-30 at 12:05 PM..
 
Wow, not sure how I missed this thread before writing my own almost three years later...
 
Eh, I often have difficulty finding threads or posts that I know exist; searching for something that may not exist, or may have been named much differently, is more difficult.

I've occasionally thought of trying to put together a modest catalog of all of the scripts that are posted, so that someone could easily see what has been done before, but when that happens, I immediately take a nap until the feeling passes :-) Of course, once you've got the catalog of what has been done, the natural next step would be to do the same for scripts that have been suggested or requested.
 
Seems like the sort of thing a forum system is poorly equipped to handle, and would be a *lot* of work for one person to maintain. Would be nice to have a Digg-like voting system for such things (and more general feature requests).
 
I am trying to make a script that will total the minutes and add 5 minutes to every 25 minutes of actions. That way I can quickly total how much real time will be spent doing tasks. So for example 55 minutes of actions would be 2 pomodoro's and a total of two 5 minute breaks (10 minutes) or an hour with five minutes of extra time that didn't fit in a pomodoro.

I am stuck for some reason this won't repeat on minutes higher than 100 and I can't figure out why.

Copy into your clipboard 76 and then run this script and it works as expected.

Then copy into your clipboard 100 and run this script and you can see it doesn't repeat totalMinutes even though it is less then 25 as listed.

Code:


set totalMinutes to the clipboard

set numberOfPomodoros to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if totalMinutes < 25 then exit repeat
	set totalMinutes to totalMinutes - 25 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.
	set numberOfPomodoros to numberOfPomodoros + 1 --This makes the every 25 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat

set totalMinutes to the clipboard --This just takes the IngTotal that was set in the clipboard and starts fresh again with total minutes of all selected actions.

set pomodoroWithBreak to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if totalMinutes < 25 then exit repeat
	set totalMinutes to totalMinutes - 25 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.
	set pomodoroWithBreak to pomodoroWithBreak + 30 --This makes the every 25 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat



set pomodoroHours to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if pomodoroWithBreak < 60 then exit repeat
	set pomodoroWithBreak to pomodoroWithBreak - 60 --This subtracts the minutes of each pomodoro + the 5 minute break figured from above
	set pomodoroHours to pomodoroHours + 1 --This makes the 60 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat




display dialog "Total full pomodoros : " & numberOfPomodoros & " +" & totalMinutes & " minutes extra" & return & "Total pomodoro time: " & pomodoroHours & " hours " & totalMinutes & " minutes" buttons {"OK"} default button 1
Here is the complete code of what I am trying to do. Again it works as long as the minutes don't go above 100 and I don't see why.

Code:
--http://forums.omnigroup.com/showthread.php?t=9983

-- 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)
-- James O'Leary (jpo@me.com), 2008-08-11 
-- now can handle context view "boxes) (assigned an estimated time of 0) and the time displayed is in hours and minutes instead of
-- just a straight up hours number. Displays in dialog box now instead of copying to clipboard. Item count displayed as well.
-- Aaron Hunyady (aaron@hunyady.net), 2009-08-01
-- Removed "cancel" button in dialog. Total time in minutes is copied to the clipboard.
-- Ben Davidson (benjamin@idavidson.ca), 20009-05-02
-- Updated the Growl notification feature and removed the dialogue box (you need to install the Growl extra, "growlnotify" - included in the install disk image)
-- Changed some of the dialog wording
-- Bill Palmer, 2011-01-30
-- Control use of growl vs. dialog box with useGrowlPref property, gracefully handle case where growlnotify not installed.
-- Also warn if any of the included tasks did not have a duration estimate

property useGrowl : false -- set this to false if you don't (want to) use Growl
property growlNotifyPath : "/usr/local/bin/growlnotify" -- default location for growlnotify installation

tell application "OmniFocus"
	tell front document
		tell document window 1
			set oTrees to selected trees of content
			set lngTrees to count of oTrees
			set underEstimate to ""
			
			if lngTrees > 0 then
				set lngTotal to 0 --This is here so when you repeat for multiple selected actions it works
				repeat with iTree from 1 to lngTrees
					set oTask to value of (item iTree of oTrees)
					
					
					try
						set lngMinutes to estimated minutes of oTask
					on error
						set lngMinutes to 0
					end try
					
					if lngMinutes as string is equal to "missing value" then
						set lngMinutes to 0
						set underEstimate to "
Warning: a task had no estimated duration!"
					end if
					
					
					set lngTotal to lngTotal + lngMinutes --IngTotal now equals the total number of minutes.  This seems more complicated than it needs to be.
					--set lngTotal to lngMinutes --No need to add 0 when all you need is the number if you onlly have one selected action. Otherwise it would set the last selected action as the IngTotal
					
				end repeat
			end if
			set the clipboard to lngTotal as rich text -- This doesn't seem to be needed
		end tell
	end tell
	set lngHours to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
	repeat
		--IngTotal at this point is the total of all selected actions in minutes
		if lngTotal < 60 then exit repeat
		set lngTotal to lngTotal - 60 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.  This leaves IngTotal with a value less then 60 which is the minutes left.
		set lngHours to lngHours + 1 --This makes the 60 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
	end repeat
end tell
if lngHours = 1 then
	set strPluralHours to " hour " --These just makes the sentence read correctly
else
	set strPluralHours to " hours "
end if
if lngMinutes = 1 then
	set strPluralMinutes to " minute"
else
	set strPluralMinutes to " minutes"
end if
if lngTrees = 1 then
	set strPluralTasks to "task"
else
	set strPluralTasks to "tasks"
end if



set totalMinutes1 to the clipboard


set totalMinutes2 to the clipboard

set numberOfPomodoros to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if totalMinutes2 < 25 then exit repeat
	set totalMinutes2 to totalMinutes2 - 25 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.
	set numberOfPomodoros to numberOfPomodoros + 1 --This makes the every 25 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat



set totalMinutes3 to the clipboard --This just takes the IngTotal that was set in the clipboard and starts fresh again with total minutes of all selected actions.

set pomodoroWithBreak to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if totalMinutes3 < 25 then exit repeat
	set totalMinutes3 to totalMinutes3 - 25 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.
	set pomodoroWithBreak to pomodoroWithBreak + 30 --This makes the every 25 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat



set pomodoroHours to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
repeat
	if pomodoroWithBreak < 60 then exit repeat
	set pomodoroWithBreak to pomodoroWithBreak - 60 --This subtracts the minutes of each pomodoro + the 5 minute break figured from above
	set pomodoroHours to pomodoroHours + 1 --This makes the 60 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
end repeat


--set


if useGrowl then
	set fp to (POSIX file growlNotifyPath)
	tell application "Finder"
		if not (exists fp) then
			set useGrowl to false
		end if
	end tell
end if



if useGrowl then
	do shell script growlNotifyPath & " Estimated Project Time -a OmniFocus -m ' " & lngTrees & " " & strPluralTasks & "
 " & (lngHours) & "" & strPluralHours & "and " & lngTotal & "" & strPluralMinutes & underEstimate & "' "
else
	display dialog "Item count: " & lngTrees & "
" & "Total time: " & lngHours & strPluralHours & lngTotal & strPluralMinutes & return & "Total minutes: " & totalMinutes1 & return & underEstimate & return & "Total full pomodoros : " & numberOfPomodoros & " +" & totalMinutes2 & " minutes extra" & return & "Total pomodoro time: " & pomodoroHours & " hours " & totalMinutes3 & " minutes" buttons {"OK"} default button 1
	
	(*I don't understand why they need the parenthesis around IngHours it doesn't seem to make a difference so I took it out above since it seemed confusing
		display dialog "Item count: " & lngTrees & "
		" & "Total time: " & (lngHours) & strPluralHours & lngTotal & strPluralMinutes & return & "Total minutes: " & totalMinutes & return & underEstimate buttons {"OK"} default button 1
	*)
	
	
	
	(*
	This is how I would do it but they are just putting returns in the quotes above which is another way I didn't realize you could do until today 2012-06-13
		display dialog "Item count: " & lngTrees & return & "Total time: " & (lngHours) & strPluralHours & lngTotal & strPluralMinutes & return & underEstimate buttons {"OK"} default button 1
	*)
	
end if

--IngTrees = Number of tasks selected
--IngHours = Total hours of selected tasks
--IngTotal = Total minutes of selected tasks
--Cli

(*

This is an example of how to set the contents of the clipboard and also set the clipboard to a variable. http://macscripter.net/viewtopic.php?id=8396
	set myString to "Hello There!"
	set the clipboard to myString -- This is how you set the clipboard to a name so you can use that value.
	set myClipboard to the clipboard
*)

Last edited by skillet; 2012-06-18 at 05:35 AM..
 
The problem is that you're reading that number in as a string, not a number. After that is resolved, the rest of the code doesn't work quite right, at least as I understand the goal. I've attached a version that figures out how many whole pomodori are required, plus the minutes of a fractional pomodoro, plus a 5 minute break after each full pomodoro. If it's not what you wanted, well, as my long-ago boss was fond of saying, you know where the sources are...

Code:
(* test values: 0 15 25 26 76 300 301 325 326 *)

property pFullPomodoroMinutes : 25
property pFullPomodoroBreak : 5
property pHour : 60

set requestedMinutes to the clipboard as integer

set numberOfPomodoros to requestedMinutes div pFullPomodoroMinutes
set fractionalPomodoroMinutes to requestedMinutes - (numberOfPomodoros * pFullPomodoroMinutes)

set totalMinutes to numberOfPomodoros * (pFullPomodoroMinutes + pFullPomodoroBreak) + fractionalPomodoroMinutes

set pomodoroHours to totalMinutes div pHour
set pomodoroMinutes to totalMinutes - (pomodoroHours * pHour)

display dialog "Total full pomodoros : " & numberOfPomodoros & " +" & fractionalPomodoroMinutes & " additional minutes" & return & "Total pomodoro time: " & pomodoroHours & " hours " & pomodoroMinutes & " minutes" buttons {"OK"} default button 1
 
Quote:
Originally Posted by whpalmer4 View Post
The problem is that you're reading that number in as a string, not a number. After that is resolved, the rest of the code doesn't work quite right, at least as I understand the goal. I've attached a version that figures out how many whole pomodori are required, plus the minutes of a fractional pomodoro, plus a 5 minute break after each full pomodoro. If it's not what you wanted, well, as my long-ago boss was fond of saying, you know where the sources are...
Thank you yet again whpalmer4 you have helped me out so many times! That is awesome and much cleaner than the approach I was doing. That is exactly what I was looking for and gave me the help I needed to finish the rest of it.

See the link for the finished script.

http://reference.studioprime.com/for...l_Pomodoro.zip

I hope some day I meet you so I can thank you in person. Your skills amaze and wow me! Thanks for helping me, especially when I know you aren't into tracking time like this.

In case the link gets broken here is the script.

Code:
--http://forums.omnigroup.com/showthread.php?t=9983

-- Pomodoro addition Whpalmer4 and Adam Olson, 2012-06-18
-- 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)
-- James O'Leary (jpo@me.com), 2008-08-11 
-- now can handle context view "boxes) (assigned an estimated time of 0) and the time displayed is in hours and minutes instead of
-- just a straight up hours number. Displays in dialog box now instead of copying to clipboard. Item count displayed as well.
-- Aaron Hunyady (aaron@hunyady.net), 2009-08-01
-- Removed "cancel" button in dialog. Total time in minutes is copied to the clipboard.
-- Ben Davidson (benjamin@idavidson.ca), 20009-05-02
-- Updated the Growl notification feature and removed the dialogue box (you need to install the Growl extra, "growlnotify" - included in the install disk image)
-- Changed some of the dialog wording
-- Bill Palmer, 2011-01-30
-- Control use of growl vs. dialog box with useGrowlPref property, gracefully handle case where growlnotify not installed.
-- Also warn if any of the included tasks did not have a duration estimate

property useGrowl : false -- set this to false if you don't (want to) use Growl
property growlNotifyPath : "/usr/local/bin/growlnotify" -- default location for growlnotify installation
property pFullPomodoroMinutes : 25
property pFullPomodoroBreak : 5
property pHour : 60


tell application "OmniFocus"
	tell front document
		tell document window 1
			set oTrees to selected trees of content
			set lngTrees to count of oTrees
			set underEstimate to ""
			
			if lngTrees > 0 then
				set lngTotal to 0 --This is here so when you repeat for multiple selected actions it works
				repeat with iTree from 1 to lngTrees
					set oTask to value of (item iTree of oTrees)
					
					
					try
						set lngMinutes to estimated minutes of oTask
					on error
						set lngMinutes to 0
					end try
					
					if lngMinutes as string is equal to "missing value" then
						set lngMinutes to 0
						set underEstimate to "

Warning: 
A task had no estimated duration!"
					end if
					
					
					set lngTotal to lngTotal + lngMinutes --IngTotal now equals the total number of minutes.  This seems more complicated than it needs to be.
					--set lngTotal to lngMinutes --No need to add 0 when all you need is the number if you onlly have one selected action. Otherwise it would set the last selected action as the IngTotal
					
				end repeat
			end if
			set the clipboard to lngTotal as rich text -- This doesn't seem to be needed
		end tell
	end tell
	set lngHours to 0 --We need this as our starting point, if you make this a 1 then it would always be one hour more than your total or a 2 is two hours more than your real total
	repeat
		--IngTotal at this point is the total of all selected actions in minutes
		if lngTotal < 60 then exit repeat
		set lngTotal to lngTotal - 60 --This subtracts the minutes each time and allows you to convert it into hours each time it loops in the next line.  This leaves IngTotal with a value less then 60 which is the minutes left.
		set lngHours to lngHours + 1 --This makes the 60 minutes you subtracted above get converted into 1 hour and then when it loops again if it can it adds one to the new total of hours.  Pretty neat!
	end repeat
end tell
if lngHours = 1 then
	set strPluralHours to " hour " --These just makes the sentence read correctly
else
	set strPluralHours to " hours "
end if
if lngMinutes = 1 then
	set strPluralMinutes to " minute"
else
	set strPluralMinutes to " minutes"
end if
if lngTrees = 1 then
	set strPluralTasks to "task"
else
	set strPluralTasks to "tasks"
end if

-----
--Pomodoro portion by whpalmer4 + some additional stuff.

set requestedMinutes to the clipboard as integer

set numberOfPomodoros to requestedMinutes div pFullPomodoroMinutes
set fractionalPomodoroMinutes to requestedMinutes - (numberOfPomodoros * pFullPomodoroMinutes)

set totalMinutes to numberOfPomodoros * (pFullPomodoroMinutes + pFullPomodoroBreak) + fractionalPomodoroMinutes

set pomodoroHours to totalMinutes div pHour
set pomodoroMinutes to totalMinutes - (pomodoroHours * pHour)

set totalBreakMinutes to numberOfPomodoros * pFullPomodoroBreak
set totalBreakHours to totalBreakMinutes div pHour
set fractionalBreakMinutes to totalBreakMinutes - (pHour * totalBreakHours)

---

if fractionalPomodoroMinutes = 1 then
	set fractionalPomodoroMinutesPlural to " additional minute "
else
	set fractionalPomodoroMinutesPlural to " additional minutes "
end if

if pomodoroHours = 1 then
	set pomodoroHoursPlural to " hour "
else
	set pomodoroHoursPlural to " hours "
end if

if pomodoroMinutes = 1 then
	set pomodoroMinutesPlural to " minute "
else
	set pomodoroMinutesPlural to " minutes "
end if

if totalBreakHours = 1 then
	set totalBreakHoursPlural to " hour "
else
	set totalBreakHoursPlural to " hours "
end if

if pomodoroMinutes = 1 then
	set fractionalBreakMinutesPlural to " minute "
else
	set fractionalBreakMinutesPlural to " minutes "
end if

---
-----



if useGrowl then
	set fp to (POSIX file growlNotifyPath)
	tell application "Finder"
		if not (exists fp) then
			set useGrowl to false
		end if
	end tell
end if



if useGrowl then
	do shell script growlNotifyPath & " Estimated Project Time -a OmniFocus -m ' " & lngTrees & " " & strPluralTasks & "
 " & (lngHours) & "" & strPluralHours & "and " & lngTotal & "" & strPluralMinutes & underEstimate & "' "
else
	
	
	
	display dialog "Selected actions: " & lngTrees & "
" & "Total time of selected actions: " & return & lngHours & strPluralHours & lngTotal & strPluralMinutes & return & return & return & "Total pomodoro time: " & return & pomodoroHours & pomodoroHoursPlural & pomodoroMinutes & pomodoroMinutesPlural & return & return & "Total break time: " & return & totalBreakHours & totalBreakHoursPlural & fractionalBreakMinutes & fractionalBreakMinutesPlural & return & return & "Total full pomodoros: " & return & numberOfPomodoros & " +" & fractionalPomodoroMinutes & fractionalPomodoroMinutesPlural & return & return & underEstimate buttons {"OK"} default button 1
end if



--IngTrees = Number of tasks selected
--IngHours = Total hours of selected tasks
--IngTotal = Total minutes of selected tasks
By the way if anyone does enable the growl function you will have to update that portion of the script since I didn't take time to update that to include the Pomodoro.
Attached Thumbnails
Click image for larger version

Name:	PomodoroTime.png
Views:	655
Size:	45.7 KB
ID:	2432  

Last edited by skillet; 2012-06-19 at 10:30 AM..
 
 


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 04:31 AM.


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