Drafts Action Directory

Add to Sorted (Bulk)

Posted by kjaymiller, Last update 15 days ago

Designed for adding multiple tasks in one go, the Bulk Sorted Add loads all items in a list.

If the title starts with “#”, the title will be set as a list.

Install

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    var project = draft.processTemplate('[[Line|1]]');
    console.log(project)
    let baseURL = 'sorted://x-callback-url/add/'
    let reTasks = /(- (\[ \] ){0,1})(.+)/g
    // TODO: Add Logic for - [ ]
    // TODO: Group expression to filter out - ([ ])
    
    tasks = []
    
    while ((match = reTasks.exec(draft.content)) != null) {
     var url = CallbackURL.create();
        url.baseURL = baseURL;
        url.addParameter('title', match[3]);
        if (project.startsWith('#'))
        url.addParameter('list', project.substring(2))
        var success = url.open();
    }

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.