Action

Process Meeting Notes

Posted by @nahumck, Last update over 4 years ago

Process meeting notes to send task-prefixed (- [ ] ) items to Todoist or Things. Save to specified file in iCloud Drive.

Note: You’ll need to deactivate one of the options in the settings to avoid saving to both Todoist and Things.

Steps

  • script

    // Process Meeting Notes
    
    // Scan for lines with tasks and send them to a task manager
    var d = draft.content;
    var lines = d.split("\n");
    var n = '';
    
  • script

    /* --- Todoist ---*/
    let todoist = Todoist.create();
    for (var line of lines) {
    	if (line.includes("- [ ]")) {
    		// Todoist Action
    		var task = line.replace("- [ ]","");
    		task = task.trim();
    		var credential = Credential.create("Todoist", "Todoist API");
    		credential.addTextField("token", "Token");
    		credential.authorize();
    		let success = todoist.quickAdd(task);
    		if (success) {
    			console.log("Todoist task created: " + task);
    		}
    		else {
    			ctErrors++;
    			console.log("Todoist error: " + todoist.lastError);
    		}
    	}
    	else {
    	// do nothing with the line
    	}
    }
  • script

    /* --- Things --- */
    for (var line of lines) {
    	if (line.includes("- [ ]")) {
    		var todo = TJSTodo.create();
    		var title = line.replace("⇢","");
    		title = title.trim();
    		todo.title = title;
    		var container = TJSContainer.create([todo]);
    		// Use CallbackURL object to open URL in Things.
    		var cb = CallbackURL.create();
    		cb.baseURL = container.url;
    		var success = cb.open();
    		if (success) {
    			console.log("Task created in Things");
    		}
    		else {
    			context.fail();
    		}
    	}
    	else {
    	// do nothing with the line
    	}
    }
  • file

    fileNameTemplate
    [[safe_title]].txt
    folderTemplate
    /Work/
    template
    [[draft]]
    local
    false
    writeType
    create

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.