Action

Pick a Project

Posted by tommertron, Last update over 2 years ago - Unlisted

Pick a project from a list in a specified draft and send the title of the task to Things in the specified project. Anything below the title will show up as notes in the Things task.

To use, replace the UUID placeholder in the script with the UUID with your list of projects.

Thanks to the wonderful drafts community for helping with this!

Note - you will need a drafts list with exact names of your projects. I automatically run a keyboard maestro script once a day on my Mac to make sure this is updated. I’d suggest a similar set up if you use this with lots of Things projects, otherwise updating can get quite tedious.

Steps

  • script

    // get the real UUID value from (i) info for your draft with the list
    let d = Draft.find("EB56EF87-FD5F-4FCC-9FB4-8994AB986594");
    // split the draft into an array of lines...
    let list = d.content.split("\n");
    
    var selections = []
    
    // now you can loop over the lines to add to your prompt...
    
    for (let item of list) {
        selections.push(item)
    }
    
    var p = Prompt.create();
    
    p.title = "Pick a project";
    p.message = "What project is it for?"
    p.addSelect("project", "Project", selections, [], false)
    p.addButton("OK");
    
    var selected_proj = p.show()
    
    var target_project = p.fieldValues["project"][0];
    
    var encodedProject = encodeURIComponent(target_project);
    
    //app.setClipboard(encodedProject)
    app.setClipboard(p.fieldValues["project"][0])
  • callbackUrl

    template
    things:add?title=[[title]]¬es=drafts5://x-callback-url/open?uuid=[[uuid]]%0A%0A[[body]]&list=[[clipboard]]
    waitForResponse
    false
    encodeTags
    true

Options

  • After Success Archive
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.