Action

Count Template Tag Distribution

Posted by @sylumer, Last update about 1 year ago - Unlisted

Steps

  • script

    function counter(p_tag)
    {
      let inbox = Draft.query("", "inbox", [p_tag]).length;
      let flagged = Draft.query("", "flagged", [p_tag]).length;
      let archive = Draft.query("", "archive", [p_tag]).length;
      let all = Draft.query("", "all", [p_tag]).length;
      let trash = Draft.query("", "trash", [p_tag]).length;
      let out = `${p_tag}
    inbox: ${inbox}
    flagged: ${flagged}
    archive: ${archive}
    all: ${all}
    trash: ${trash}`;
      return out;
     }
    
    function tagCount(tagged)
    {
      let a = counter(tagged.toLowerCase());
      let b = counter(tagged.toUpperCase());
      let c = counter(tagged.charAt(0).toUpperCase() + tagged.slice(1));
      return [a,b,c].join("\n\n");
    }
    
    alert(tagCount("template"));
    

Options

  • After Success Default
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.