Action

Save to Dropbox Fileline

Posted by drdrang, Last update over 6 years 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

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
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.