Estoy tratando de crear un script que copie eventos de mi calendario laboral a uno personal pero solo como bloques de tiempo para que mi cónyuge sepa cuando tengo reuniones. Después de buscar en internet un poco, llegué al siguiente script que funciona en su mayor parte.
set SourceCalendarName to "Trabajo"
set DestinationCalendarName to "Espejo"
set today to current date
set numberofdays to 7
set startday to ((current date) - (1 * days))
set endday to ((current date) + (numberofdays * days))
tell application "Calendario"
set sourceCalendar to calendar SourceCalendarName
set destinationCalendar to calendar DestinationCalendarName
-- Copiar eventos de la fuente al destino --
repeat with sourceEvent in (get events of sourceCalendar whose (start date is greater than or equal to startday) and (start date is less than endday))
tell sourceEvent
set |allday event| to allday event
set |start date| to start date
set |end date| to end date
set |recurrence| to recurrence
set |description| to description
set |summary| to summary
set |status| to status
set |summary| to "Reunión VV"
end tell
delete (events of destinationCalendar whose start date is equal to |start date| and end date is equal to |end date|)
tell destinationCalendar
set destEvent to (make new event at end of events with properties {start date:|start date|, end date:|end date|, summary:|summary|})
end tell
end repeat
end tell
Estoy tratando de no tener la parte de eliminar eventos, pero comprobar si ya existe un evento y no molestar en crear un evento en primer lugar
delete (events of destinationCalendar whose start date is equal to |start date| and end date is equal to |end date|)
¿Alguna idea de cómo modificar esto a una condición 'if' para que el 'tell' del evento sea opcional?
Gracias