Action

Smart Reminder in Due

Posted by @mattbirchler, Last update almost 6 years ago

Create simple reminder in Due. The reminder name must always be on the first line. The only other value that can be passed is a due date based on how far in the future you’d like to be reminded.

Acceptable times must be prefixed with “in “ or “In “ and can be in seconds, minutes, or hours. Examples would be:

in 180 seconds // “secs” also accepted
in 4 minutes // “mins” also accepted

in 16 hours // “hrs” also accpted

Steps

  • script

    var arr = draft.content.split("\n");
    
    var baseURL = "due:///add";
    var addLink = CallbackURL.create();
    addLink.baseURL = baseURL;
    
    
    for (i = 0; i < arr.length; i++) {
    	// The reminder name
    	if (i == 0) {
    		addLink.addParameter("title", arr[i]);
    	}
    
    	// The time
    	else if (arr[i].slice(0,3) == "in " || arr[i].slice(0,3) == "In ") {
    		var the_string = arr[i];
    		var the_number = the_string.replace(/\D/g,'');
    		
    		if (the_string.includes("seconds") || the_string.includes("secs")) {
    			addLink.addParameter("secslater", the_number);
    		} else if (the_string.includes("minutes") || the_string.includes("mins")) {
    			addLink.addParameter("minslater", the_number);
    		} else if (the_string.includes("hours") || the_string.includes("hrs")) {
    			addLink.addParameter("hourslater", the_number);
    		}
    		
    		
    	}
    };
    
    // alert(addLink);
    
    
    // open and wait for result
    var success = addLink.open();

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.