Action

Save to Files as...

Posted by agiletortoise, Last update about 2 years ago

UPDATES

about 2 years ago

Fallback to default filename

Export to files, prompting for file name.

Steps

  • script

    // setup default values
    let title = draft.processTemplate("[[safe_title]]")
    const ext = "txt"
    if (title.length == 0) {
    	title = "untitled"
    }
    
    // prompt for file name
    let p = Prompt.create();
    p.title = "Save as..."
    p.addTextField("fileName", "Name", title + "." + ext)
    p.addButton("Export")
    
    if (p.show()) {
       let fileName = p.fieldValues["fileName"]
       draft.setTemplateTag("file", fileName)
    }
    else {
      context.cancel()
    }
  • export

    fileNameTemplate
    [[file]]
    template
    [[draft]]

Options

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