Automator iCal Aktion ja?/nein?

M

mac*berlin

Aktives Mitglied
Thread Starter
Dabei seit
29.12.2006
Beiträge
6.431
Reaktionspunkte
201
Hi,

besteht die Möglichkeit, ein Automator Script oder Applescript zu erstellen welches lautet,

markiere in kalender 1 alle termine die noch nicht im Kalender 2 sind, kopiere sie und füge sie in Kalender 2 ein.

geht das?

Gruß und dank

Steffen
 
Jo geht. Automator pur bin ich mir nicht sicher aber Applescript 100pro.
 
Hast du ne Ahnung wie oder wo ich nachlesen kann ?
 
Hallo!

Mit dem Automator geht das nicht.
Mit AS hier ein Beispiel-Skript: Klick


Folgende Zeilen im Skript solltest du löschen:
if endDate ≥ curDate and eventStatus is not none then
und
else
log "Event discarded: old"
end if


Gruß
 
Hallo!

Mit dem Automator geht das nicht.
Mit AS hier ein Beispiel-Skript: Klick


Folgende Zeilen im Skript solltest du löschen:
if endDate ≥ curDate and eventStatus is not none then
und
else
log "Event discarded: old"
end if


Dank dir, super link und tip.

habe jetzt das Script angepasst und wenn ich es ausführe dann bekomme ich ein dropdown Menü wo ich zuerst den quellkalender und dann den zielkalender auswählen soll. so dacht ich mir das.

Gruß

hi,

danke für den link und den tip, was entfernt werden muss.

habe es jetzt mal angepasst und bekomme beim ausführen ein dropdown Menü welchen quellkalender und zielkalender und anschließend wird es kopiert. klasse

für alle die es vielleicht auch suchen hier das script

Code:
--iCal Event Duplicator.scpt
--Writen by Mike Cramer
--January 10, 2011 ~ 4pm CST
-- Modified by Marco Dondero: added recurrent events and checks to avoid copying an already existing event
-- September 4, 2011
--
--Assume GPL style license.


to getRecurrenceTermination(startDate, recurrenceString)
	set olddel to AppleScript's text item delimiters
	set AppleScript's text item delimiters to ";"
	set tItems to text items of recurrenceString
	set AppleScript's text item delimiters to "="
	set d to 0
	set untl to missing value
	repeat with anItem in tItems
		
		set parts to text items of anItem
		set sec to word 3 of anItem
		
		if (offset of "FREQ=" in anItem) > 0 then
			if (offset of "WEEKLY" in anItem) > 0 then
				set d to 7
			else if (offset of "DAILY" in anItem) > 0 then
				set d to 1
			else if (offset of "MONTHLY" in anItem) > 0 then
				set d to 31
			end if
		else if (offset of "INTERVAL=" in anItem) > 0 then
			set d to d * sec
		else if (offset of "COUNT=" in anItem) > 0 then
			set d to d * sec
		else if (offset of "UNTIL=" in anItem) > 0 then
			set untl to current date
			set untl's year to text 1 thru 4 of sec
			set untl's month to text 5 thru 6 of sec
			set untl's day to text 7 thru 8 of sec
			set untl's hours to text 10 thru 11 of sec
			set untl's minutes to text 12 thru 13 of sec
			set untl's seconds to text 13 thru 14 of sec
		end if
	end repeat
	set AppleScript's text item delimiters to olddel
	
	if untl is missing value then
		if d is not 0 then
			set finalDate to startDate + (d * days)
		else
			set finalDate to startDate + (1000 * days)
		end if
	else
		set finalDate to untl
	end if
	return finalDate
end getRecurrenceTermination

tell application "iCal"
	
	set TheCalendars to name of calendars
	
	set theSourceCalendar to ""
	set theDestinationCalendar to ""
	
	choose from list TheCalendars with title "cal1" without empty selection allowed
	set theSourceCalendar to result as string
	
	if theSourceCalendar is "" then
		--do nothing
	else
		
		set theOtherCals to {}
		repeat with anItem in TheCalendars
			if (anItem as string) is not (theSourceCalendar as string) then set theOtherCals to theOtherCals & anItem
		end repeat
		
		choose from list theOtherCals with title "backupcal" without empty selection allowed
		set theDestinationCalendar to result as string
		
		
		if theDestinationCalendar is "" then
			--do nothing
		else
			
			display dialog "Copy calendar events from " & theSourceCalendar & " to " & theDestinationCalendar & "?" buttons {"OK", "Cancel"} default button 2
			if the button returned of the result is "OK" then
				set TheEvents to events of calendar theSourceCalendar
				set otherEvents to events of calendar theDestinationCalendar
				repeat with anEvent in TheEvents
					set curDate to current date
					set isNew to 1
					set startDate to start date of anEvent
					set endDate to end date of anEvent
					set eventStatus to status of anEvent
					set recuInfo to recurrence of anEvent
					set auid to uid of anEvent
					if recuInfo is not missing value then
						set ed to my getRecurrenceTermination(startDate, recuInfo)
					end if
					--check that is not already existing using uid of events
					repeat with oEvent in otherEvents
						set ouid to uid of oEvent
						if ouid is equal to auid then
							set isNew to 0
							exit repeat
						end if
					end repeat
					if isNew is not 0 then
						duplicate anEvent to end of calendar theDestinationCalendar
					end if
				end repeat
			else
				--do nothing
			end if
		end if
	end if
end tell
 
hi,

also leider zu früh gefreut.

ich habe mich gestern Abend getraut den eigentlichen Kalender mittels script sichern zu wollen und dabei hängt sich das script andauernd auf.

wahrscheinlich liegt das an den kalndereinträgen der letzten 3 Jahre!

jemand ne Ahnung wie ich das script vielleicht zeitlich eingrenzen kann und so etappenweise arbeite?
 
Habe es eben auch mal getestet. Das liegt nicht an deinen alten Einträgen, sondern an wiederkehrenden Events. Dabei verschluckt er sich. Leider kann ich dir gerade auch keine Lösung hierzu präsentieren.

edit: Muss mich korrigieren. Funktioniert soweit ABER sofern du ein Event innerhalb eines wiederkehrenden Events löscht, wird dieses nicht kopiert. Sagen wir du hast ein Event was sich 3 mal wiederholt. Kopierst deine Kalender, sind beide identisch. Nun löscht du aus deinem Quellkalender NUR das zweite Event des Wiederkehrenden und führst das Script nochmals aus. Dann kopiert er nix. Aber einzelne Events funktionieren ob vor unter hinter wiederkehrenden Einträgen. Hab auch vor 10 Jahren getestet.
 
Zuletzt bearbeitet:
Hm danke für deine Info.

Hab's nicht ganz verstanden, aber hört sich wenig komfortabel an, dann müsst ich ja die ganztägigen Ereignisse ja manuell per Hand erst kopieren richtig?
 
Gut, mit ganztätigen habe ich es nicht probiert. Hast du denn Einträge, die sich wiederholen z.b. jede Woche oder so? Wenn nicht, dann weiß ich erstmal auch nicht.
 
ich habe ein Ereignis, welches sich wöchentlich wiederholt.

du meinst das sollte ich löschen?
 
Ist zumindest ein Versuch wert. Löschen musst ja nicht, einfach in einen anderen Kalender schieben tuts ja auch.
 
Zurück
Oben Unten