Make Title Current Appointment

Posted by tommertron, Last update about 1 month ago

Gets the current (or most recent) calendar event (within a 3 hour window) and changes to the title of the draft.


  • 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 =,; => 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");
    else app.displayWarningMessage("No events found");


  • 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.