Drafts Action Directory

Save to Dropbox Fileline

Posted by drdrang, Last update 5 months ago

Save a draft to Dropbox according to a “fileline” (like a vi modeline) in the draft. The fileline will typically be in a comment and will be of the form:

dbox:/path/to/file.ext

Install

Steps

  • script

    // Set template tags for Dropbox path and file name
    // from dbox: file line in draft.
    
    var d = draft.content;
    
    // Regex for fileline.
    var fileRE = /dbox:(.+)\/(.+)$/m;
    
    // Get the year and month and set the path.
    var fileline = d.match(fileRE);
    var path = fileline[1] + '/';
    var filename = fileline[2];
    draft.setTemplateTag('dbox_path', path);
    draft.setTemplateTag('dbox_filename', filename);	
    
  • dropbox

    fileNameTemplate
    [[dbox_filename]]
    folderTemplate
    [[dbox_path]]
    template
    [[draft]]
    writeType
    replace

Options

  • After Success Default
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.