Drafts Action Directory

Assemble diary

Posted by drdrang, Last update 3 months 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.

Install

Steps

  • script

    // Start a new draft
    editor.new();
    
    // 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;
    	diaryDrafts[i].update();
    }
    
    // Make the diary
    editor.setText(diaryContent);
    editor.save();
    

Options

  • After Success Nothing
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.