Plug-In: Complete and Await Reply

This script is based on an AppleScript script for OmniFocus by Curt Clifton. It allows you to mark your currently selected task as complete, and duplicates the task with `Waiting on reply: ` prefixed to the original task name. This allows you to quickly complete a task (such as “Email Bob about his cat”) and also add the appropriate related action. This script does not add a waiting tag to the new task, but that could be added after line 21 with dupTasks[0].addTag(tagNamed('Waiting On')); (this assumes your tag is called Waiting On). — Rosemary Orchard

/*{ "author": "Rosemary Orchard", "targets": ["omnifocus"], "type": "action", "identifier": "com.rosemaryorchard.omnifocus.complete-and-await-reply", "version": "1.0", "description": "Mark the currently selected task as complete and add a new task to await the reply.", "label": "Complete and Await Reply", "mediumLabel": "Complete and Await Reply", "paletteLabel": "Complete and Await Reply", }*/ (() => { let action = new PlugIn.Action(function(selection) { let duplicatedTasks = new Array() selection.tasks.forEach(function(task){ insertionLocation = task.containingProject if(insertionLocation === null){insertionLocation = inbox.ending} dupTasks = duplicateTasks([task], insertionLocation) dupTasks[0].name = "Waiting on reply: " +; duplicatedTasks.push(dupTasks[0].id.primaryKey); task.markComplete(); }); idStr = duplicatedTasks.join(",") URL.fromString("omnifocus:///task/" + idStr).open() }); action.validate = function(selection){ return (selection.tasks.length >= 1) }; return action; })();