Action

Packing List

Posted by @nahumck, Last update over 3 years ago

UPDATES

over 3 years ago

  1. Fixed the prompt script
  2. Streamlined script steps to be non-repetitive
  3. Made a listed action

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 p = Prompt.create();
      p.title = "Enter List Name";
      p.addTextField("listName","Name","");
      p.addButton("OK")
      p.show();
    
    var title = p.fieldValues["listName"];
    draft.setTemplateTag("title", title);
  • clipboard

    template
    # [[title]] Packing List
    
    ## Toiletries
    - [ ] Deodorant
    - [ ] Toothbrush
    - [ ] Toothpaste
    - [ ] Shampoo/Conditioner
    - [ ] Bodywash/Soap
    - [ ] Hair/Beard Products
    - [ ] Nose Spray & Strips
    - [ ] Medicine
    - [ ] Shaving Kit
    - [ ] Sunscreen
    - [ ] Bug Spray 
    - [ ] Q-Tips
    
    ## Personal Items
    - [ ] Book
    - [ ] Pillow
    - [ ] Earphones
    - [ ] Earplugs
    - [ ] Tissues
    - [ ] Cash
    - [ ] Electronics and Chargers 
    - [ ] Camera Bag/Equipment
    - [ ] AeroPress
    - [ ] 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
    - [ ] Light schedules
    - [ ] Thermostat
    - [ ] Take Out Garbage
    - [ ] Lock House
    - [ ] Arm Alarm/Camera System
    
    ## Miscellaneous
    - [ ] 
    
    ----
    ## Completed
  • script

    // 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("");
  • script

    /* --- Reminders --- */
    
    //Create Task in Reminders
    
    var list = ReminderList.findOrCreate("Inbox")
    var reminder = list.createReminder();
    reminder.title = "Pack for "+ title;
    reminder.url = url;
    reminder.notes = url;
    
    var success = reminder.update();
    if (success) {
    	console.log("Task created");
    }
    else {
    	 console.log(cb.status);
    	 if (cb.status == "cancel") {
    		context.cancel();
    	}
    	else {
    		context.fail();
    	}
    }
    editor.activate(d);
  • script (disabled)

    /* --- Things --- */
    
    // 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 (disabled)

    /* --- GoodTask --- */
    
    // 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 (disabled)

    /* --- Todoist --- */
    
    // 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.