Assemble diary

Posted by drdrang, Last update over 5 years ago

Collect all drafts in the Inbox that are tagged “diary” and assemble their content into a single new summary draft. Each diary entry is stamped in the summary with the date, time, and location at which it was created. The individual diary entry drafts are Archived.


  • script

    // Start a new draft;
    // Get all the "diary" drafts in the inbox
    var diaryDrafts = Draft.query("", "inbox", ["diary"]);
    // Assemble
    var ds = draft.processTemplate("[[date|%Y-%m-%d %H:%M %z]]");
    var diaryContent = "Diary as of " + ds + "\n\n";
    for (var i=0; i<diaryDrafts.length; i++) {
    	var stamp = diaryDrafts[i].processTemplate("[[created|%Y-%m-%d %H:%M %z]]") + "\n" + diaryDrafts[i].processTemplate("[[created_latitude]], [[created_longitude]]") + "\n";
    	diaryContent += stamp + diaryDrafts[i].content + "\n\n";
    	diaryDrafts[i].isArchived = true;
    // Make the diary


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