Action

Snooze

Posted by Chris Grieser, Last update 9 days ago

UPDATES

9 days ago

as the NLP is too unreliable, changed the NLP-textfield for the date to a date picker

ATTENTION: This action only works with a shortcut and some specific settings. Alone, this action will not function as intended.

Look at the Setup Instructions.


Snooze a draft by sending it to Reminders. Set the due date to the date when your task should re-appear in Drafts.

The “Due date“ field supports natural language parsing of dates, so things like “2pm Friday”, or “next Wednesday” work for specifying due date.


Change the „settings“ of this draft by changing the respective values in line 13 or 24 of the script.

Steps

  • script

    let title = draft.processTemplate("[[title]]");
    let notes = draft.processTemplate("[[body]]");
    
    let f = () => {
    	let lists = ReminderList.getAllReminderLists();
    	
    	let p = Prompt.create();
    	p.title = "Snooze"
    	p.message = "Select options for new Reminder below.";
    
    	p.addDatePicker("dueDate", "due date", new Date(), {
      		"mode": "date"
    	});
    	
    	p.addTextField("title", "Title", title, {
    		"wantsFocus": true
    	});
    	p.addTextView("notes", "Notes", notes, {});
    	
    	
    	p.addButton("Create Reminder");
    	if (!p.show()) {
    		return 1;
    	}
    	
    //Set the list to which you want to send the draft. The order of lists in the Reminders App is used, with 0 being the first, 1 the second, 2 the third, etc. 
    	let list = lists[0]; // <-- this number
    	let rem = list.createReminder();
    	
    	rem.title = p.fieldValues["title"];
    	rem.notes = p.fieldValues["notes"];
    	let dStr = p.fieldValues["dueDate"];
    	if (dStr && dStr.length > 0) {
    		rem.dueDate = Date.parse(dStr);
    	}
    	if (rem.update()) {
    		console.log("Reminder created");
    	}
    	else {
    		console.log("Error creating reminder");
    		return -1;
    	}
    	return 0;
    }
    
    let result = f();
    switch (result) {
    	case -1: context.fail(); break;
    	case 1: context.cancel(); break
    }

Options

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