Expanding the ‘Send To’ submenu of Merlin

File > Send ToA very practical feature of Merlin is its “Send To” sub menu.  It can extract information out of a Merlin file and send it to another application. Per default you find only the application “Billings” listed, but you can expand this sub menu by creating your own AppleScripts.

To demonstrate how this works, we are going to tell Merlin to create automatically a PNG picture file of the current Gantt chart and to send it to the Preview.app

So here we go:

1. Please open the Script Editor

(OS X 10.5.x /Applications/AppleScript/Script Editor, OS X 10.6.x /Applications/Utilities/Apple Script Editor)

2. Copy and paste the following AppleScript code into the Script Editor.

on run argv
	set merlinApp to "Merlin"
	if number of items in argv > 0 then
		set merlinApp to first item of argv
	end if
	using terms from application "Merlin"
		tell application merlinApp

			set doc to the first document
			export doc as png file to path "/tmp/merlin.png"
			tell application "Finder"
				open POSIX file "/tmp/merlin.png"
			end tell
		end tell
	end using terms from
end run

3. Click in Script Editor onto “Compile”

4. Start Merlin in case it not already running.

5. Call File > Send To > Open Scripts Folder (it shows the path to Merlin Scripts folder which is ~/Library/Application Support/Merlin/SendToMenu )

6. Save the script  by File/Save as… in Merlin’s Scripts folder
…and give a telling name to the script, i.e. “Preview”.

7. Now you can re-start Merlin and open a project file, preferably one displaying its Gantt chart.

8. Call “File/Send To” and see your script listed in the sub menu. Click it on, and see Preview.app starting automatically and displaying a picture of the Gantt chart.

PreviewSchnappschuss002
Surely this is a very simple sample but it shows the almost never ending possibilities you have in Merlin via AppleScript.

If you want to learn more about AppleScript you may want to check out the Developer Connection documentation provided by Apple:

UPDATE:

March 28, 2012: Modified information describing how to find the location of Merlin’s Scripts Folder.