Plug-In: Assign Default Notification
Adds a notification to the selected tasks or projects matching their date and time due.
Return to: OmniFocus Plug-In Collection
Assign Default Notification
/*{
"type": "action",
"targets": ["omnifocus"],
"author": "Otto Automator",
"identifier": "com.omni-automation.of.assign-default-notification",
"version": "1.0",
"description": "Adds a notification to the selected tasks or projects matching their date and time due.",
"label": "Assign Default Notification",
"shortLabel": "Default Notification",
"paletteLabel": "Default Notification",
"image": "checkmark.rectangle.stack"
}*/
(() => {
const action = new PlugIn.Action(async function(selection, sender){
try {
selection.databaseObjects.forEach(item => {
if(item instanceof Project || item instanceof Task){
dateDue = item.dueDate
if(dateDue){
item.addNotification(dateDue)
}
}
})
}
catch(err){
if(!err.causedByUserCancelling){
console.error(err.name, err.message)
new Alert(err.name, err.message).show()
}
}
});
action.validate = function(selection, sender){
return (selection.tasks.length > 0 || selection.projects.length > 0)
};
return action;
})();