Merlin: AppleScript handling selected activities

My favorite AppleScript ‘template’ is the one we have created handling the currently selected activities. I use it from time to time, to reset the completeness percentage or define all selected activities as milestones.

You can also use it of course when wanting to forward activity information to other applications. In the Google user group of Merlin some samples are supplied for transferring To Dos to Things or TimeLine 3D.

But why making a short story long? Here you are. Enjoy my favorite AppleScript ‘template’:

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 doc to the first document
		set proj to root project of doc
		set TheMerlinProj to title of proj

		set allActivities to myselection

		repeat with act in allActivities
			set TheTitle to title of act as text
			if class of act is activity then
				-- do something with the activity
			end if
		end repeat
	end if
end tell

Use it wisely, as they say;-) And when you do, please let us know what your script is modified to do.