Action

Export Selected Drafts

Posted by sylumer, Last update over 1 year ago

Export selected files to the file location defined by the Drafts folder bookmark “Export To”.

Steps

  • defineTemplateTag

    name
    fileextension
    template
    md
  • script

    function exportDraft(p_fm, p_draft, p_strFileExtension)
    {
    	let strFileName = p_draft.processTemplate("[[safe_title]].") + p_strFileExtension;
    	p_fm.writeString(strFileName, p_draft.processTemplate("[[body]]"));
    	app.displayInfoMessage("Exported " + strFileName);
    }
    
    let bmExport = Bookmark.findOrCreate("Export To");
    let fmExport = FileManager.createForBookmark(bmExport);
    app.currentWindow.selectedDrafts.map(dExp => exportDraft(fmExport, dExp, draft.processTemplate("[[fileextension]]"))); 
    

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.