Applescript – Remove estimation flag for selected tasks

The default value for work in new activities can be defined in the project settings of a Merlin project. Just call File > Project Settings… > General > Default Work and see ‘1 day ?’

The question mark stands for “estimated” and will be visualized in the inspector as a check mark.

In the Gantt you see those question marks wherever there are tasks with estimated work entries…

We have been asked in support, how to quickly remove this “estimated” flag on more than one tasks of a project at once. The answer we can give here is, try an applescript. You simply need to select all tasks in question, read the planned work information in an applescript loop, check if it is “estimated” and disable this option if necessary.
Enjoy 🙂

tell application "Merlin"	
	activate
	set myselection to selected object of main window of document 1 as list
	
	if (count of myselection) is 0 then
		display dialog "Please select the activities you would like to handle." buttons {"OK"}
	else
		set allActivities to myselection
		
		repeat with act in allActivities
			tell act
				if ((class is not project) and (is milestone is not true)) then
					set TheWork to planned work
					try
						# put it in a try to work only for tasks on which work has been assigned
						tell TheWork of me
							# get work duration properties
							set TheAmount to amount
							set TheUnit to unit
							set TheFloat to floating
						end tell
						if relative error of TheWork is 1 then
							set given planned work to {amount:TheAmount, unit:TheUnit, floating:TheFloat, relative error:0}
						end if
					end try
				end if
			end tell
		end repeat
	end if
end tell