Action

Simple Things to-do

Posted by ohthreefive, Last update about 6 years ago

VERY simple javascript action

  • Takes all of the text from the Draft
  • Sets that as the to-do title
  • Allows you to specify which project to add it to
  • Replace PROJECT NAME HERE! but keep the double quotes to do that
  • If you just want the to-do to land in your inbox, delete the line beginning “todo.list =“
  • Once the to-do is created, you bounce back to Drafts with that Draft then being deleted

Go here to learn more about Drafts scripting and Things.

Steps

  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    /* simple drafts scrip action
    take Draft & add to Things project
    no other Things meta-data is added but this
    would be easy to implement:
    http://reference.getdrafts.com/objects/Things.html */
    
    thing = editor.getText();
    var todo = TJSTodo.create();
    todo.title = thing;
    todo.list = ["PROJECT NAME HERE!"];
    var container = TJSContainer.create([todo]);
    var cb = CallbackURL.create();
    cb.baseURL = container.url;
    var success = cb.open();
    if (success) {
    	console.log("Project created in Things");
    }
    else {
    	context.fail();
    }

Options

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