Action

Add to Sorted

Posted by kjaymiller, Last update about 6 years ago

V1.6 Update:
FIX - error where if no List was given it would create an “Inbox” list that is not the default inbox.

Adds the text as a whole to Sorted3.

Sorted only uses the first line as a title. All other lines will become the body (note) of the task.

If a “#” is immediately followed by text, that text will be used as the list (NOT case specific).

For lists with spaces, surround the words (but now the “#” with quotes (dumb quotes)

v1.5 - added list functionality

For any questions or requests contact kjaymiller via his website

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    function popParameters(re, content=editor.getText()){
    
    // find all of the special parameters in a draft
    
    if ((match = re.exec(content)) != null) {
    var start = match.index
    var len = match[0].length
    editor.setTextInRange(start, len, '')
    return match[0]
    }
    
    return ''
    }
    
    let list = /#"*\w+(( \w*)*")*/g
    draft.setTemplateTag('list', popParameters(list).replace('#','').replace(/"/g,''))
    
  • url

    template
    sorted://x-callback-url/add?title=[[draft]]&list=[[list]]
    useSafari
    false
    encodeTags
    true

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.