omnifocusCompleteAwaitReply

/*{ "author": "Jay Freestone", "targets": ["omnifocus"], "type": "action", "identifier": "com.jayfreestone.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", }*/ (() => { const action = new PlugIn.Action(function(selection) { const waitingTag = tags.find(({ name }) => name === "Waiting") || new Tag("Waiting"); const duplicatedTasks = selection.tasks.map(task => { const insertLoc = task.containingProject || inbox.ending; const [dupTask] = duplicateTasks([task], insertLoc); dupTask.name = `Waiting on reply: ${dupTask.name}`; dupTask.addTag(waitingTag); return dupTask; }); selection.tasks.forEach(task => task.markComplete()) const idStr = duplicatedTasks .map(({ id }) => id.primaryKey) .join(","); URL.fromString("omnifocus:///task/" + idStr).open() }); action.validate = function(selection){ return (selection.tasks.length >= 1) }; return action; })(); /*{ "author": "Jay Freestone", "targets": ["omnifocus"], "type": "action", "identifier": "com.jayfreestone.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", }*/ (() => { const action = new PlugIn.Action(function(selection) { const waitingTag = tags.find(({ name }) => name === "Waiting") || new Tag("Waiting"); const duplicatedTasks = selection.tasks.map(task => { const insertLoc = task.containingProject || inbox.ending; const [dupTask] = duplicateTasks([task], insertLoc); dupTask.name = `Waiting on reply: ${dupTask.name}`; dupTask.addTag(waitingTag); return dupTask; }); selection.tasks.forEach(task => task.markComplete()) const idStr = duplicatedTasks .map(({ id }) => id.primaryKey) .join(","); URL.fromString("omnifocus:///task/" + idStr).open() }); action.validate = function(selection){ return (selection.tasks.length >= 1) }; return action; })(); /*{ "author": "Jay Freestone", "targets": ["omnifocus"], "type": "action", "identifier": "com.jayfreestone.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", }*/ (() => { const action = new PlugIn.Action(function(selection) { const waitingTag = tags.find(({ name }) => name === "Waiting") || new Tag("Waiting"); const duplicatedTasks = selection.tasks.map(task => { const insertLoc = task.containingProject || inbox.ending; const [dupTask] = duplicateTasks([task], insertLoc); dupTask.name = `Waiting on reply: ${dupTask.name}`; dupTask.addTag(waitingTag); return dupTask; }); selection.tasks.forEach(task => task.markComplete()) const idStr = duplicatedTasks .map(({ id }) => id.primaryKey) .join(","); URL.fromString("omnifocus:///task/" + idStr).open() }); action.validate = function(selection){ return (selection.tasks.length >= 1) }; return action; })();