Estoy tratando de hacer un espejo de un calendario en otro por un período de tiempo establecido (digamos 1 semana). Sin embargo, cuando ejecuto el script a continuación, solo copia eventos no recurrentes. Cualquier sugerencia sobre cómo solucionar esto es muy apreciada
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set SourceCalendarName to "VV Main"
set DestinationCalendarName to "VV Mirror"
set meetingProxy to "VV Meeting"
set today to current date
set numberofdays to 7
set startDay to ((current date) - (1 * days))
set time of startDay to 0
set endDay to ((startDay) + (numberofdays * days))
--set time of endDay to
set numberOfEventsAdded to 0
tell application "Calendar"
set sourceCalendar to calendar SourceCalendarName
set destinationCalendar to calendar DestinationCalendarName
(*
tell destinationCalendar
delete (events)
end tell
*)
set sourceEventList to (events of sourceCalendar where (its start date > startDay) and (its start date < endDay))
repeat with eventIdx from 1 to length of sourceEventList
set newEvent to item eventIdx of sourceEventList
--repeat with newEvent in (get events of sourceCalendar whose (start date is greater than startDay) and (start date is less than endDay))
set existingEventList to (events of destinationCalendar)
set eventExists to false
if length of existingEventList is not 0 then
repeat with checkEvent in existingEventList
if ((start date of checkEvent = start date of newEvent) and (end date of checkEvent = end date of newEvent)) then
set eventExists to true
exit repeat
end if
end repeat
end if
if eventExists is false then
tell destinationCalendar
set destEvent to (make new event at end of events with properties {start date:start date of newEvent, end date:end date of newEvent, summary:meetingProxy, allday event:allday event of newEvent, description:(uid of newEvent as text)})
if recurrence of destEvent is not missing value then
set recurrence of destEvent to recurrence of newEvent
end if