Plug-In: Clear Notes of Tasks with Tag
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.0",
"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": "gearshape"
}*/
(() => {
var action = new PlugIn.Action(async function(selection, sender){
// action code
// selection options: tasks, projects, folders, tags, allObjects
var tagTitles = flattenedTags.map(tag => tag.name)
var textInputField = new Form.Field.String(
"tagTitle",
"Tag Title",
null,
null
)
var inputForm = new Form()
inputForm.addField(textInputField)
inputForm.validate = function(formObject){
var tagTitle = formObject.values['tagTitle']
if(!tagTitle){return false}
if(tagTitles.includes(tagTitle)){
return true
} else {
return false
}
}
var formObject = await inputForm.show("Enter the tag title:","Continue")
var tagTitle = formObject.values['tagTitle']
var tagObj = flattenedTags.byName(tagTitle)
tagObj.tasks.forEach(task => {
task.note = ""
})
});
action.validate = function(selection, sender){
// validation code
// selection options: tasks, projects, folders, tags, allObjects
return true
};
return action;
})();