Merlin Applescript – Am I on time?

When scheduling a project in Merlin and want to know whether you are on time or in delay… just watch the Gantt chart.

ScreenSnapz006

Grey bars show planned values, coloured your actual progress as you go. Is the last activity of your project displayed in the timeline earlier than its according grey element? In this case you may expect to be finished before the planned end. Is your last activity displayed later than its grey pair? So you are late.

If you prefer numbers than visual information, just enable the display of the columns “expected end date” and “planned end date” in the outline. As you update your project and enter actual values on it, expected values change to show the new updated situation. Check those values on the top most row of the outline (which is a handle to your project) and subtract them manually to have an numerical answer to the question: Am I on time…

ScreenSnapz003
In case you do prefer using your time for PM tasks and not for simple maths, you may call the following AppleScript and let it do the necessary subtraction for you.

(* 	Scripting with Merlin 2

	You may incorporate this ProjectWizards sample code into your program(s) without
	restriction.  This ProjectWizards sample code has been provided "AS IS" and the
	responsibility for its operation is yours.  You are not permitted to
	redistribute this ProjectWizards sample code as "ProjectWizards sample code" after having
	made changes.  If you're going to redistribute the code, we require
	that you make it clear that the code was descended from ProjectWizards sample
	code, but that you've made changes.

	Copyright ©2010 ProjectWizards, Melle, Germany. All rights reserved.
*)

(*
	This script checks planned and expected end dates of the top most opened project and informs about it being on time, in delay, or earlier as expected.

	Written by Vicky Stamatopoulou
	For ProjectWizards
	Dec 1, 2010
*)
--

property NeedAProjectMessage : "You must have an open project in order to run this script"
property DoneMessage : "Your project is "
property decimal_separator : "."
-- This script uses . as a decimal separator, if this is not the case in your system, please define here the appropriate decimal separator string.

on format_number(the_number, decimals)
	-- the_number is the number to be formatted.
	-- decimals is the number of decimal places. Must be 0 or greater.
	
	set decimals to decimals as integer -- make sure, decimals is an integer
	-- make sure, types are OK
	set the_number to the_number as number
	set decimal_separator to decimal_separator as text
	
	set the_sign to "" -- change the empty string to "+" if you want signed numbers
	if the_number < 0 then
		set the_sign to "-"
		set the_number to -the_number
	end if
	
	set X to round (the_number * (10 ^ decimals)) rounding as taught in school
	
	set X_digits to ""
	repeat while X is not less than 1
		set X_digits to (((X mod 10) as integer) as string) & X_digits
		set X to X div 10
	end repeat
	
	repeat while (length of X_digits < decimals + 1)
		set X_digits to "0" & X_digits
	end repeat
	-- extract digits after decimal point 	
	set D_digits to ""
	if decimals > 0 then
		set D_digits to text -decimals thru -1 of X_digits
	end if
	
	set X_digits to text 1 thru (-decimals - 1) of X_digits
	
	if decimals = 0 then
		return X_digits
	end if
	return X_digits & decimal_separator & D_digits
end format_number

tell application "Merlin"
	global inList
	try
		set doc to the first document
	on error
		display dialog NeedAProjectMessage
		set chosenFile to (choose file)
		open chosenFile
		set doc to the first document
	end try
	
	set proj to root project of doc
	
	tell proj
		
		-- read expected and planned end values
		set ExpEnd to expected end date
		set PlanEnd to planned end date
		
		set TheDif to format_number((PlanEnd - ExpEnd) / 24 / 60 / 60, 2.0, decimal_separator) of me
		set SignCheck to PlanEnd - ExpEnd
		
		if SignCheck < 0 then set info to TheDif & " days in delay"
		if SignCheck > 0 then set info to TheDif & " days earlier than the stipulated date"
		
		if SignCheck = 86400 then set info to TheDif & " day earlier than the stipulated date"
		if SignCheck = -86400 then set info to TheDif & " day in delay"
		
		if SignCheck = 0 then set info to "on time"
		
		set ProjectInfo to info & "."
	end tell
	
	display dialog DoneMessage & ProjectInfo buttons {"Ok"}
end tell

One thought on “Merlin Applescript – Am I on time?

  1. I love this software so much, also my friends.The only problem is there is no language package for chinese. Do you have plan to make one? I wish to translate it,if you want it please contact me!

Comments are closed.