Action
Make Title Current Appointment
Gets the current (or most recent) calendar event (within a 3 hour window) and changes to the title of the draft.
Steps
-
script
// Initialise let calDefault = Calendar.default(); let foundAppointments = []; let eventsCount = 0 // Grab events from last 3 hours (based on current time) and append them to an array let aev = calDefault.events(Date.today().addMinutes(-180), Date.now()); aev.map(ev => foundAppointments.push(ev.title)); for (const foundAppointment of foundAppointments){ eventsCount = eventsCount +1; } // Get the latest event found and add to drafts with a markdown title if(foundAppointments.length > 0) { draft.prepend ("# " + foundAppointments [eventsCount-1] + "\n"); draft.update(); } else app.displayWarningMessage("No events found");
Options
-
After Success Nothing Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.