Applescript – Merlin’s script folder

When using Merlin to manage and plan your projects on Mac OS X you can enhance its functions by AppleScript. We have posted various AppleScript samples in this blog. Feel free to download, use but also modify any way you think appropriate.

Some notes on this:

  • To place a new AppleScript in Merlin’s script folder just drag your Applescript in the folder Merlin opens over File > Send To > Open Scripts Folder
  • For new scripts to be listed under File > Send To, you need to re-start Merlin.
  • If editing a script located in the scripts folder, you need to re-start Merlin, before your newly saved version of the script is available over the Send To  sub menu.
  • If looking for the path of Merlin’s script folder, by a cmd+click on its title row……you will see it placed under: Your Mac > Your hard disk > Users > Your User Name > Library > Application Support > Merlin > SendToMenu
  • If looking for it over the Finder and checking the contents of your home directory, don’t be surprised not seeing the “Library” folder. This is a feature of Lion, according to which the “Library” folder is an invisible folder.

Applescript – Access elements

This is a small “how to” showing how to access elements in Merlin projects over Applescript.

If you want to access all elements of a currently opened Merlin project:

tell application "Merlin"
	set proj to root project of document 1
	set myElements to deep elements of proj
	repeat with aObj in myElements
              get aObj
        end repeat
end tell

If you want to access elements of the currently selected activity rows:

tell application "Merlin"
	set myselection to selected object of main window of document 1 as list
	repeat with aObj in myselection
               get element of aObj as list
		--to iterate in them
                repeat with anElement in element of aObj as list
                      display dialog title of aObj & ": " & title of anElement
		end repeat
	end repeat
end tell


elements of… asks for the elements attached on the object itself. While deep elements of… asks also for elements attached in sub objects as well.

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
 Continue reading 

Applescript – Visualise exceptions as activities

In Merlin you can enter exceptions for holidays or exceptional working days in the working time inspector. Exceptions applying for the complete project should be entered in the project calendar. Those affecting only a specific resource, should be entered in its calendar.

From time to time we get asked in support how one could visualize those exceptions in the Gantt. Merlin shows non working days in grey, but it has no explicit function for showing which grey date ranges belong to which exception.

To solve this, we wrote a small applescript creating activities out of the defined exceptions of a resource. To test it, just check the following script:

(* 	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 ©2011 ProjectWizards, Melle, Germany. All rights reserved.
*)

(*
	Name: Creates activities for visualation of the exceptions of a selected resource
	(German: Erstellt Vorgänge für die Visualisierung der Ausnahmen im Ressourcenkalender einer ausgewählten Ressource)
	Author:	Vicky Stamatopoulou for ProjectWizards, Copyright 2011
	Info: The script prompts for the name of resource, creates the activities, handles title of exception, start & end dates, and working mode
	Date: 	June 1st 2011	 	       						

*)

Continue reading

Merlin: Applescript splitting activity

From time to time we get asked whether it is possible to split an activity in Merlin so it can be assigned to various resources at different time periods. Well, you will not find an explicit function doing so, but if you like, you may use the following AppleScript.

If you save it under ~/Library/Application Support/Merlin/SendToMenu it will always be accessible in Merlin over the File > Send To submenu.

Continue reading