Action

Packing List

Posted by nahumck, Last update over 5 years ago - Unlisted

Create a pre-defined packing list in Drafts, prompting for a Trip Name via dictation. Sends a task to Things, GoodTask, or Todoist with the permalink to the draft appended to the note.

Note: Simply disable or delete the script steps which you do not need to use.

Steps

  • script

    var title = editor.dictate();
    draft.setTemplateTag("title", title);
  • clipboard

    template
    # [[title]] Packing List
    
    ## Toiletries
    - [ ] Deodorant
    - [ ] Toothbrush
    - [ ] Toothpaste
    - [ ] Hair Products
    - [ ] Nose Spray & Strips
    - [ ] Medicine
    - [ ] Shaving Kit
    - [ ] Sunscreen
    - [ ] Bug Spray 
    - [ ] Q-Tips
    
    ## Personal Items
    - [ ] Book
    - [ ] Earphones
    - [ ] Earplugs
    - [ ] Tissues
    - [ ] Cash
    - [ ] Electronics and Chargers 
    - [ ] Camera Bag/Equipment
    - [ ] Itinerary
    - [ ] Boarding Passes
    - [ ] Passport
    
    ## Clothing
    - [ ] Socks
    - [ ] Underwear
    - [ ] Pants/belts/shorts
    - [ ] Shirts
    - [ ] PJ's
    - [ ] Shoes/boots/sandals
    - [ ] Sunglasses
    - [ ] Jacket (Rain at Min)
    - [ ] Other Outerwear(gloves, Hat, Etc)
    - [ ] Bathing Suit
    
    ## Tasks Before Leaving
    - [ ] Stop Mail
    - [ ] Clear Fridge
    - [ ] Turn off ice maker
    - [ ] Print Tickets
    - [ ] Parking Coupon
    - [ ] Check-in for Flight
    - [ ] Thermostat
    - [ ] Take Out Garbage
    - [ ] Lock House
    - [ ] Arm Alarm/Camera System
    
    ## Miscellaneous
    - [ ] 
    
    ----
    ## Completed
  • script

    /* --- Things --- */
    
    // create list in a new draft and clear clipboard
    var d = Draft.create();
    d.content = app.getClipboard();
    d.update();
    var url = d.permalink;
    app.setClipboard("");
    
    // Create list as a single task in Things with a url in the note
    var todo = TJSTodo.create();
    todo.title = "Pack for "+title;
    todo.notes = url;
    var container = TJSContainer.create([todo]);
    var cb = CallbackURL.create();
    cb.baseURL = container.url;
    var success = cb.open();
    if (success) {
    	console.log("Task created in Things");
    }
    else {
    	context.fail();
    }
    editor.activate(d);
  • script

    /* --- GoodTask --- */
    
    // create list in a new draft and clear clipboard
    var d = Draft.create();
    d.content = app.getClipboard();
    d.update();
    var url = d.permalink;
    app.setClipboard("");
    
    // Create list as a single task in GoodTask with a URL for use with Quick Actions
    // full URL options for GoodTask
    // goodtask3://add?title=[prompt:Title]&list=[prompt:List Name]&due=[prompt:Due Date]&dueAfter=[prompt-num:Due after]&alarm=[prompt-num:Alarm]&priority=[prompt-num:Priority]&url=[prompt:URL]&notes=[prompt:Notes]
    const baseURL = "goodtask3://x-callback-url/add?";
    var cb = CallbackURL.create();
    cb.baseURL = baseURL;
    cb.addParameter("title", "Pack for "+title);
    cb.addParameter("url", url);
    var success = cb.open();
    if (success) {
    	console.log("Task created");
    }
    else {
    	 console.log(cb.status);
    	 if (cb.status == "cancel") {
    		context.cancel();
    	}
    	else {
    		context.fail();
    	}
    }
    editor.activate(d);
  • script

    /* --- Todoist --- */
    
    // create list in a new draft and clear clipboard
    var d = Draft.create();
    d.content = app.getClipboard();
    d.update();
    var url = d.permalink;
    app.setClipboard("");
    
    // Create list as a single linked task in Todoist
    var title = d.title;
    var task = "[Pack for "+title+"]("+url+")";
    let todoist = Todoist.create();
    let success = todoist.quickAdd(task);
    if (success) {
    	console.log("Todoist task created: " + task);
    }
    else {
    	ctErrors++;
    	console.log("Todoist error: " + todoist.lastError);
    }
    editor.load(d)
    editor.activate(d);

Options

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