Merlin – Creating Milestones out of iCal todos

With Merlin you can create proffessional project schedules. You can export or sync your tasks to iCal and have them in you calendar application. We have posted an AppleScript showing how one could export the tasks of the current selection.

You also know how to import an iCal calendar as exceptions to your project or resource’s calendar.

Creating tasks out of an iCal calendar is also possible by an AppleScript we wrote and posted here.

But what should you do, if you have entered lots of Todos in your iCal calendar and need these in Merlin? The short answer is: “Use an AppleScript”. The longer – because it contains the script as well – is, you can modify the script we have posted for transferring iCal events as tasks to Merlin so that it additionally handles iCal Todos. As todos have no duration, we decided to define them in Merlin as milestones. To make a long story shorter again, just check the following script:

(*
	This script requires iCal. It prompts the list of your iCal calendars for you to select the calendar out of which new tasks should be created in Merlin. It writes in the top most opened Merlin project.
	Version 1.0
        Written by Vicky Stamatopoulou
	For ProjectWizards
	Nov 3, 2010

	version 1.01
	changed on Jan 17, 2011
	changed by Vicky Stamatopoulou
	info: added support for todos, they will get created as milestones
*)

---
property CalendarSelectionMessage : "Which calendar should be transferred to Merlin?"
property EventsImportMessage1 : "s found in calender  "
property EventsImportMessage2 : ". Are you sure you want to import them all?"
property DoneMessage : "s as milestones created. Please enable 'Given Planned Earliest Start' column, sort by it and adjust project's start date if neccessary."
property ErrorMessage : "There were no todos in the calendar, so there are no new milestones created."
---------------------------
on importListItems(AnyList, aCal)

	global TheClass
	tell application "iCal"
		if (count of AnyList) > 0 then
			display dialog (((count of AnyList) & " " & (class of first item of AnyList) as text) & EventsImportMessage1 & title of aCal & EventsImportMessage2) as text
			set I to 0

			repeat with AnEvent in AnyList

				set TheClass to class of AnEvent
				tell AnEvent
					set ASummary to summary
					if TheClass is event then
						set AStart to start date
						set AnEnd to end date
					else
						set AStart to due date
						set AnComplete to completion date
						set ThePrio to priority as text
					end if
				end tell

				tell application "Merlin"

					set theAct to make new activity at end of activities of root project of the first document
					tell theAct
						set title to ASummary
						try
							set given planned start date min to AStart
						end try

						if (TheClass is event) then
							set given planned end date min to AnEnd
							delete given planned work
						else
							try
								set is milestone to true
								if AnComplete is not missing value then

									set given actual completion to 1.0
									set actual start date to AnComplete
								end if
							end try
						end if
					end tell
				end tell
				set I to I + 1

			end repeat

			tell application "Merlin"
				activate
				display dialog (I & " " & (class of first item of AnyList) as text) & DoneMessage as text buttons {"Ok"}
			end tell
		else
			display dialog ErrorMessage buttons {"Ok"}
		end if
	end tell
end importListItems

tell application "iCal"

	activate
	set theCals to title of calendars

	set theCal to choose from list theCals with prompt CalendarSelectionMessage without multiple selections allowed

	if theCal is not false then
		set myCal to item 1 of (calendars whose title contains theCal)

		-- remove the comment characters if you want to import events as well

		--set TheEvents to events of myCal
		--importListItems(TheEvents, myCal) of me

		-- comment this out of you want to do this import in two steps
		set TheToDos to todos of myCal
		importListItems(TheToDos, myCal) of me

	end if
end tell

3 thoughts on “Merlin – Creating Milestones out of iCal todos

  1. Hi Vicky,
    Actually I was going for Reminders-> Merlin as milestones but trying to get Reminder Notes to Merlin.. The Reminders lists are shown by this script and import correctly. But just missing the TheNotes attribute…. So maybe looking at your other suggestions, I can modify the above script to import Notes.

    Thank you for your help.

  2. hmmm, above script used to work with iCal and Calendar back then where todos weren’t split..

    following script imports all reminders of a selected list, it will also transfer the reminder note in the Merlin milestone note
    Have fun:

    (*
    This script requires Reminders. It prompts the reminder lists for you to select one out of which new milestones should be created in Merlin. It writes in the top most opened Merlin project.
    Version 1.0
    Written by Vicky Stamatopoulou
    For ProjectWizards
    Sept 21, 2014

    *)


    property ReminderListSelectionMessage : “Which list should be transferred to Merlin?”
    property EventsImportMessage1 : “s found in selected list ”
    property EventsImportMessage2 : “. Are you sure you want to import them all?”
    property DoneMessage : “s as milestones created. Please enable ‘Given Planned Earliest Start’ column, sort by it and adjust project’s start date if neccessary.”
    property ErrorMessage : “There were no reminders in the list, so there are no new milestones created.”
    —————————
    on importListItems(AnyList, aReminderItem)

    tell application “Reminders”
    if (count of AnyList) > 0 then
    display dialog (((count of AnyList) & ” ” & (class of first item of AnyList) as text) & EventsImportMessage1 & name of aReminderItem & EventsImportMessage2) as text
    set I to 0

    repeat with aReminder in AnyList

    tell aReminder
    set ASummary to name
    set AStart to due date
    set AnComplete to completion date
    set ThePrio to priority as text
    set TheNotes to body

    end tell

    tell application “Merlin”

    set theAct to make new activity at end of activities of root project of the first document
    tell theAct
    set title to ASummary
    try
    set given planned start date min to AStart
    end try

    try
    set is milestone to true
    if AnComplete is not missing value then

    set given actual completion to 1.0
    set actual start date to AnComplete
    end if
    end try

    if TheNotes is not missing value then set description to TheNotes
    end tell
    end tell
    set I to I + 1

    end repeat

    tell application “Merlin”
    activate
    display dialog (I & ” ” & (class of first item of AnyList) as text) & DoneMessage as text buttons {“Ok”}
    end tell
    else
    display dialog ErrorMessage buttons {“Ok”}
    end if
    end tell
    end importListItems

    tell application “Reminders”

    activate
    set theLists to name of lists

    set theList to choose from list theLists with prompt ReminderListSelectionMessage without multiple selections allowed

    if theList is not false then
    set myList to item 1 of (lists whose name contains theList)

    — comment this out of you want to do this import in two steps
    set TheToDos to reminders of myList
    importListItems(TheToDos, myList) of me

    end if
    end tell

  3. Thank you. It worked great. Transferred 30 lists of Reminders to Merlin & then imported NovaMind. I could then add checkbox and set up map and sync back to Reminders.

Comments are closed.