Last active
April 19, 2025 17:11
Revisions
-
wroman revised this gist
Nov 8, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,12 +36,14 @@ function sync() { if (evi.isAllDayEvent()) continue; if (n==1 || n==2 || n==3 || n==4 || n==5) // skip weekends. Delete this if you want to include weekends { var newEvent = primaryCal.createEvent('Booked',evi.getStartTime(),evi.getEndTime()); // change the Booked text to whatever you would like your merged event titles to be // alternative version below that copies the exact secondary event information into the primary calendar event // var newEvent = primaryCal.createEvent(evi.getTitle(),evi.getStartTime(),evi.getEndTime(), {location: evi.getLocation(), description: evi.getDescription()}); newEvent.removeAllReminders(); // so you don't get double notifications. Delete this if you want to keep the default reminders for your newly created primary calendar events } } -
wroman revised this gist
Nov 8, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,14 +34,14 @@ function sync() { var d = evi.getStartTime(); var n = d.getDay(); if (evi.isAllDayEvent()) continue; var newEvent = primaryCal.createEvent('Booked',evi.getStartTime(),evi.getEndTime()); // change the Booked text to whatever you would like your merged event titles to be // alternative version below that copies the exact secondary event information into the primary calendar event // var newEvent = primaryCal.createEvent(evi.getTitle(),evi.getStartTime(),evi.getEndTime(), {location: evi.getLocation(), description: evi.getDescription()}); newEvent.removeAllReminders(); // so you don't get double notifications. Delete this if you want to keep the default reminders for your newly created primary calendar events } -
wroman revised this gist
Nov 8, 2017 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,11 +34,7 @@ function sync() { var d = evi.getStartTime(); var n = d.getDay(); if (evi.isAllDayEvent() === false) { var newEvent = primaryCal.createEvent('Booked',evi.getStartTime(),evi.getEndTime()); // change the Booked text to whatever you would like your merged event titles to be // alternative version below that copies the exact secondary event information into the primary calendar event -
wroman revised this gist
Nov 8, 2017 . No changes.There are no files selected for viewing
-
wroman revised this gist
Nov 8, 2017 . No changes.There are no files selected for viewing
-
wroman created this gist
Apr 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ function sync() { var id="XXXXXXXX"; // CHANGE - id of the secondary calendar to pull events from var secondaryCal=CalendarApp.getCalendarById(id); var today=new Date(); var enddate=new Date(); enddate.setDate(today.getDate()+30); // how many days in advance to monitor and block off time var secondaryEvents=secondaryCal.getEvents(today,enddate); var primaryCal=CalendarApp.getDefaultCalendar(); var primaryEvents=primaryCal.getEvents(today,enddate); var stat=1; var evi, existingEvents; for (ev in secondaryEvents) { stat=1; evi=secondaryEvents[ev]; for (existingEvents in primaryEvents) // if the secondary event has already been blocked in the primary calendar, ignore it { if ((primaryEvents[existingEvents].getStartTime().getTime()==evi.getStartTime().getTime()) && (primaryEvents[existingEvents].getEndTime().getTime()==evi.getEndTime().getTime())) { stat=0; break; } } if (stat==0) continue; var d = evi.getStartTime(); var n = d.getDay(); if (evi.isAllDayEvent()) { return; // Do nothing if the event is an all-day or multi-day event. This script only syncs hour-based events } else if (n==1 || n==2 || n==3 || n==4 || n==5) // skip weekends. Delete this if you want to include weekends { var newEvent = primaryCal.createEvent('Booked',evi.getStartTime(),evi.getEndTime()); // change the Booked text to whatever you would like your merged event titles to be // alternative version below that copies the exact secondary event information into the primary calendar event // var newEvent = primaryCal.createEvent(evi.getTitle(),evi.getStartTime(),evi.getEndTime(), {location: evi.getLocation(), description: evi.getDescription()}); newEvent.removeAllReminders(); // so you don't get double notifications. Delete this if you want to keep the default reminders for your newly created primary calendar events } } }