I use a Omnifocus to run everything in my life, including recurring tasks
e.g. “Process Cell Phone Voice Mail (R:1d)” in this example the suffice (R:1d) is my shorthand for this task repeats every day.
after a week goes by I now have 7 instances of that task, 6 marked completed and one open for today.
I would like to write a script that identifies these completed daily tasks and deletes them. These completed tasks are high volume (1 per day) and they serve no purpose on the archive. Plus, I archive only every few months so… the clutter gets significant.
I’d appreciate any pointers on how to create such a garbage collection script. thx
currentMonth = new Date().getMonth()
cutOffDate = new Date().setMonth(currentMonth - 1); // 1 months ago from the current day
flattenedTasks.forEach(task => {
if (task.repetitionRule != null && task.completed && task.completionDate < cutOffDate) {
if (task.repetitionRule.ruleString === "FREQ=DAILY") {
deleteObject(task)
}
}
})
That finds any items completed more than 1 month ago (from the current date) that are set to “Repeat Every: 1 Day”. If you’d want to expand it to include more types of repeating items that would certainly be possible.
If you need help turning that into a plug-in you can install or if you’d like learn how to edit that to do things a bit differently, check out these links: