Well that would explain it, including accounting for why it was not possible for me to see what other hidden meaning or property “available” would have in the realm of scripting.
I spent about an hour with Chat GPT and someone else’s script, and was able to cobble something that seems to work. Instead of facing the problem as you have spelled it out, we just found tasks that did not have any of the statuses besides Available. And then I had it modify further to exclude tasks belonging to a project or a tag that is on hold. Curious to see what you make of this, and whether any fix you cook up would be superior to this. This task also removes any Forecast Tag, although I am indifferent to this part of the script since I don’t use one. Author and such are unmodified by me.
/{
“author”: “Mark Ferlatte”,
“targets”: [“omnifocus”],
“type”: “action”,
“identifier”: “net.cryptio.clear-flag-from-tasks”,
“version”: “0.9”,
“description”: “Clear flag and forecast tag from uncompleted tasks.”,
“label”: “Clear flag and forecast tag from uncompleted tasks”,
“mediumLabel”: “Clear flag and forecast tag from uncompleted tasks”,
“paletteLabel”: “Clear flag and forecast tag from uncompleted tasks”,
}/
/* Clear flags AND clear the forecast tag */
/* global PlugIn, flattenedTasks, Tag, Task, Project */
(() => {
var action = new PlugIn.Action(function() {
let tasks = flattenedTasks.filter(task => {
return ![
Task.Status.Completed,
Task.Status.Dropped,
Task.Status.Inactive,
Task.Status.OnHold,
Task.Status.Repeating,
Task.Status.RepeatingButDueSoon,
Task.Status.RepeatingButOverdue,
].includes(task.taskStatus) &&
(!task.deferDate || task.deferDate <= new Date()) &&
!(task.containingProject instanceof Project && task.containingProject.status === Project.Status.OnHold) &&
!task.tags.some(tag => tag.status === Tag.Status.OnHold);
});
tasks.forEach(task => {
task.flagged = false;
if (Tag.forecastTag) {
task.removeTag(Tag.forecastTag);
}
});
});
action.validate = function() {
return true;
};
return action;
})();