Plug-In: Clear Notes of Tasks with Tag Apple Vision Pro

Clears the notes of the tasks that are tagged with the specified tag.

Return to: OmniFocus Plug-In Collection

Clear Notes of Tasks with Tag
   

/*{ "type": "action", "targets": ["omnifocus"], "author": "Otto Automator", "identifier": "com.omni-automation.of.clear-notes-from-tasks-with-tag", "version": "1.1", "description": "Clears the notes of the tasks that are tagged with the specified tag.", "label": "Clear Notes of Tasks With Tag", "shortLabel": "Clear Notes", "paletteLabel": "Clear Notes", "image": "text.badge.xmark" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ // action code // selection options: tasks, projects, folders, tags, databaseObjects, allObjects tagTitles = flattenedTags.map(tag => tag.name) textInputField = new Form.Field.String( "tagTitle", "Tag Title", null, null ) inputForm = new Form() inputForm.addField(textInputField) inputForm.validate = function(formObject){ tagTitle = formObject.values['tagTitle'] if(!tagTitle){return false} if(tagTitles.includes(tagTitle)){ return true } else { throw `No tag named: ${tagTitle}` } } formObject = await inputForm.show("Enter the tag title:","Continue") tagTitle = formObject.values['tagTitle'] tagObj = flattenedTags.byName(tagTitle) counter = 0 tagObj.tasks.forEach(task => { task.note = "" counter = counter + 1 }) noteOrNotes = (counter === 1) ? "note":"notes" counterValue = (counter === 0) ? "No":String(counter) msg = `${counterValue} ${noteOrNotes} cleared.` new Alert("Result", msg).show() }); action.validate = function(selection, sender){ // validation code // selection options: tasks, projects, folders, tags, databaseObjects, allObjects return true }; return action; })();