This should do what you want in a new draft, if you add an action with a single script step:
// script to get all events for
// all calendars for the next
// day, and add to a new draft
// by tf2
// get all calendars
let cals = Calendar.getAllCalendars();
// set a header string to hold
// the result
aDate = new Date();
aStr = aDate.getFullYear()+'-' + (pad2(aDate.getMonth()+1)) + '-'+ pad2(aDate.getDate());
result = "# Today's Agenda for ";
result += aStr + "\n\n";
// cycle thru calendars
for (let cal of cals) {
if (cal) {
// set today & tomorrow
let today = new Date();
let tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
// get all events
let events = cal.events(today, tomorrow);
// cycle thru each event
for (let event of events) {
// get start date
let start = event.startDate;
// get hour, minutes
let st_hour = start.getHours();
let st_min = pad2(start.getMinutes());
// add to result
result += st_hour+":"+st_min+" — ";
result += event.title;
result += "\n";
}
}
}
let d = new Draft();
d.content = result;
d.addTag("agenda");
d.update();
// function to ensure minutes
// are two digits; from
// https://electrictoolbox.com/pad-number-two-digits-javascript/
function pad2(number) {
return (number < 10 ? '0' : '') + number
}