Merlin101: Vorgänge aus iCal-Kalendern erstellen

Mit Merlin kann man professionelle Zeitabläufe erstellen. Diese lassen sich exportieren oder mit iCal synchronisieren und als Kalender weiterverwenden. Es existiert bereits ein AppleScript welches den Export von selektierten Vorgängen erlaubt. Damit lassen sich Teile eines Projekts in iCal als Kalender verwenden.

Was tun, wenn man aber Kalendereinträge aus iCal wieder als Vorgänge in Merlin einfügen möchte?

Merlin kann aus den folgenden Formaten importieren:
MS Project (.mpx, .mpp, .xml)
OmniOutliner (.ooutline, .oo3)
OmniPlan (.omniplan)
NovaMind (.nmind)
MindManager (.mmap)
Merlin 1 (.merlin)
Merlin 2 (.xml)
Text files (.txt, .csv, .tsv)
OPML files (.opml)

Leider gehört iCal (ics-Format) nicht dazu. Trotzdem kein Problem, denn wir haben ein entsprechendes AppleScript für Sie geschrieben:

(*
	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.
	Written by Vicky Stamatopoulou
	For ProjectWizards
	Nov 3, 2010
*)

---------------------------
property CalendarSelectionMessage : "Which calendar should be transferred to Merlin?"
property EventsImportMessage1 : " events found in calender  "
property EventsImportMessage2 : ". Are you sure you want to import them all?"
property DoneMessage : " tasks created. Please enable 'Given Planned Earliest Start' column, sort by it and adjust project's start date if neccessary."
property ErrorMessage : "There were no tasks in the calendar, so there are no new tasks created."
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)

		set TheEvents to events of myCal

		if (count of TheEvents) > 0 then
			display dialog ((count of TheEvents) & EventsImportMessage1 & title of myCal & EventsImportMessage2) as text
			set I to 0
			repeat with AnEvent in TheEvents

				tell AnEvent
					set ASummary to summary
					set AStart to start date
					set AnEnd to end date
				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
						set given planned start date min to AStart
						set given planned end date min to AnEnd
						delete given planned work

					end tell

				end tell
				set I to I + 1

			end repeat

			tell application "Merlin"
				activate
				display dialog I & DoneMessage as text buttons {"Ok"}
			end tell
		else
			display dialog ErrorMessage buttons {"Ok"}
		end if
	end if
end tell