Action

Org-mode capture

Posted by @davekurman, Last update over 5 years ago

Org-mode capture from Drafts app

  • Capture text from Drafts app into Org-mode.
  • Add org-mode style tags from your Drafts tags.
  • TODO: change the target org file! Edit the Dropbox step. Change /Notes/inbox.org to your target org file.

  • Org-mode: Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.

  • Org-mode Capture: Capture lets you quickly store notes with little interruption of your work flow.

  • Looking for Org-mode apps for iOS? Check out Beorg and MobileOrg

Steps

  • script

    // add org-mode tags from Drafts app tags
    
    var content = draft.content;
    var orgTags = '';
    var titleBreak = content.indexOf("\n");
    
    editor.new();
    
    if (content.trim().length > 0) {
    	var title = content.slice(0, titleBreak);
    	var oldTitle = title;	
    	var body = content.slice(titleBreak + 1);
    	
    	if (draft.tags.length > 0) {
    		orgTags = ':';
    		for (tagIndex in draft.tags) {
    			orgTags = orgTags + draft.tags[tagIndex] + ':';
    		}
    	}
    
    	title = title + ' ' + orgTags;
    
    	draft.content = title + '\n' + body;
    } else {
    	alert('Draft has no content.');
    }
  • dropbox

    fileNameTemplate
    Test.inbox.org
    folderTemplate
    /Notes
    template
    * [[title]]
    
    [[body]]
    :PROPERTIES:
    :Created:  [[[date]]] [[[time]]]
    :END:
    
    
    writeType
    prepend
  • script

    // restore original draft
    // ie. remove org-mode tags from title
    
    
    if (content.trim().length > 0) {
    	draft.content = oldTitle + '\n' + body;
    }

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.