Action

DUPLICATE BODY with options

Posted by FlohGro, Last update over 5 years ago

Duplicate the Body of the currently draft into your clipboard.
Based on a prompt you can select what to do with the draft Body:
Create a new draft in your inbox
Create a new draft and open it
Ignore it and just work with your clipboard

I use this to set titles for template drafts (like messages, contact data and so on) and use their content for mails or messaging.

Steps

  • clipboard

    template
    [[body]]
  • script

    var p = Prompt.create();
    p.title = "select final operation";
    p.message = "save or ignore?";
    p.addButton("save");
    p.addButton("save & open");
    p.addButton("ignore");
    p.isCancellable = false;
     
    p.show();
     
    if (p.buttonPressed  == "save" || p.buttonPressed == "save & open")
    {
    var d = Draft.create();
    d.content = app.getClipboard();
    d.update();
    if (p.buttonPressed == "save")
    {
    app.displaySuccessMessage("saved the draft to your inbox");
    }
    } else if (p.buttonPressed == "ignore")
    {
    app.displaySuccessMessage("saved the draft body to the clipboard");
    }
     
    if (p.buttonPressed == "save & open")
    {
    editor.load(d);
    app.displaySuccessMessage("here is your new draft");
    }
     
     
     
     

Options

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