Action

move draft

Posted by FlohGro, Last update 6 months ago

UPDATES

6 months ago

description update and small refinements in the presented prompt

created by @FlohGro / more on my Blog

move draft

This action lets you move the current draft.

Depending on where the draft is currently located you can move it to

  • the inbox
  • the archive
  • the trash
  • flag / unflag it

[Configuration]

no configuration needed

[Usage]

When you want to move a draft you can simply run this action and a prompt will display the currently valid options. To speed things up set a keyboard shortcut for this action or move it to an action bar.


If you find this useful and want to support me you can

Buy Me A Coffee

Steps

  • script

    
    // move draft
    
    var lists = [];
    
    if (draft.isArchived == true) {
      lists.push("inbox");
    } else {
      lists.push("archive");
    }
    
    if (draft.isFlagged == true) {
      lists.push("unflag");
    } else {
      lists.push("flag");
    }
    
    if (draft.isTrashed == false) {
      lists.push("trash");
    }
    
    var p = Prompt.create();
    p.title = "select action";
    p.message = "for draft \"" + draft.title + "\"";
    
    for (var list of lists) {
      p.addButton(list);
    }
    var con = p.show();
    
    if (con) {
      var sel = p.buttonPressed;
      if (sel == "archive") {
        draft.isArchived = true;
      } else if (sel == "inbox") {
        draft.isArchived = false;
      } else if (sel == "trash") {
        draft.isTrashed = true;
      } else if (sel == "unflag") {
        draft.isFlagged = false;
      } else if (sel == "flag") {
        draft.isFlagged = true;
      }
      draft.update();
    } else {
      context.cancel();
    }
    

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.