Frustrated with not being able to completed all your tasks - I hope this helps

One of the challenges using these tools for planning is that they omit to teach users about concepts of time estimates and leave it to the user to make a “best” guess at the estimated duration

The following formula for time estimate is used in the project management field.

PERT is an estimating technique that uses a weighted average of three numbers (see below) to come up with a final estimate.
Estimated duration = (O + 4M + P)/6

The most pessimistic ( P ) case when everything goes wrong
The most optimistic (O) case where everything goes right
The most likely (M) case given normal problems and opportunities

The resulting PERT estimate is calculated as (O + 4M + P)/6. This is called a “weighted average” since the most likely estimate is weighted four times as much as the other two values.
You can then add the stardard deviation (I have not included the formula) which aligns to the probability of completing the tasks within the calculated timeframe.

The issue with planning is that most people do not factor in risks (pessimistic time) and only consider optimistic estimates.

if someone can help write a script to calculate the PERT estimated duration by taking the above variables as inputs that would increase your probability of sucess ( adding the appropriate Standard deviation provides greater probability on completed the task in the calculated duration).

In summary, you may think that based on your time estimates you can complete 4 tasks, however, PERT will show that you will most likely complete only 2 tasks.
This reduces frustration of always feeling behind and missing tasks.

Hope this helps.
Colin Lopez

Using your definitions, the engineering rule of thumb becomes duration = Pi*P.



Here is a PERT Applescript

	This script sets the duration of a task based on PERT
	v 1

-- properties of this script

-- weights for Optimistic, Median, and Pessimistic targets
property pOWeight : 1
property pMWeight : 4
property pPWeight : 1

-- split handler
on do_split(theString, theDelimiter)
	set oldDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to theDelimiter
	set theArray to every text item of theString
	set AppleScript's text item delimiters to oldDelimiters
	return theArray
end do_split

-- confirm number input
on is_number(number_string)
		set number_string to number_string as number
		return true
	on error
		return false
	end try
end is_number

-- run handler
on run
	-- confirm somthing is selected
	tell application "OmniFocus"
		tell content of front document window of default document to ¬
			set theSelectionList to the value of every selected tree
		if the (count of items in theSelectionList) is 0 then
			display dialog "You must select a task in Omnifocus" buttons {"OK"} default button "OK"
		end if
	end tell

	-- start the counter
	set theCount to 0
	-- get a valid input of three numbers
	repeat while theCount < 3
		set theAnswer to the text returned of ¬
			(display dialog "Enter the Optimistic, Median, and Pessimestic times in minutes using commas between" buttons {"OK"} default answer "" default button "OK")
		if (theAnswer is "") then
		end if
		set theSplitAnswer to my do_split(theAnswer, ",")
		set theCount to the count of items in theSplitAnswer
		if (the (count of items in theSplitAnswer) < 3) then
			display dialog "You must enter three time values" buttons {"OK"} default button "OK"
		end if
		repeat with theItem in theSplitAnswer
			if (not my is_number(theItem)) then
				display dialog "You must enter three NUMERIC time values" buttons {"OK"} default button "OK"
				set theCount to 0
			end if
		end repeat
	end repeat
	-- parse out the times
	set theOTime to item 1 of theSplitAnswer
	set theMTime to item 2 of theSplitAnswer
	set thePTime to item 3 of theSplitAnswer
	-- calculate the duration time
	set theDTime to (pOWeight * theOTime + pMWeight * theMTime + pPWeight * thePTime)
	set theDTime to theDTime / (pOWeight + pMWeight + pPWeight)
	-- set the times
	tell application "OmniFocus"
		repeat with theTask in theSelectionList
			set the estimated minutes of theTask to theDTime
		end repeat
	end tell
end run

Select tasks in OmniFocus. Run the script. The inputs should be three NUMBERS separated by COMMAS. Valid input is 10,20,40. Invalid inputs by example are 10,20 or ten,twenty,30. Input nothing at the first command to exit the script.


1 Like

Thank you so much. I am traveling but cannot wait to try it when I return. This will be such a huge time saver plus increased accuracy for planning.
Colin Lopez

Thank you so much.
I first had to learn how to install and use the script.

This works awesome and I incorporating it into my workflow as it will help with the planning process.

Thanks again JJW.

PS. is there a library of different scripts. My eyes have opened to the possibilities of scripts to automate my Omnifocus workflow

The best that I can suggest is to search for Applescript and look in the OmniFocus Automation thread.