Script to automatically delete a given tag from Next Actions

As per the title, is this possible? Something that will search through Next Actions and always delete a specific tag?

thanks

Yes it’s possible to create a plugin you can trigger to do that

1 Like

If you‘re more specific…

OK, I have to ask. Why would you need that?

I like to tag projects & have a few project only tags, but every NA inherits the tags of its parent Project. So I thought I’d just wipe any inherited tags.

Understood. Let me see what I can do. Just driving home from hiking.

Just 1 or multiple tags? Your tags each have unique naming or should the plugin use tag IDs? Or do you prefer a Apple Shortcuts-based solution?

That would be very kind, thank you. Just one tag, as long as I could manually change it myself when needed.

I have a finished plugin that does the opposite. It adds certain tags set on projects to all actions and action groups within tagged projects.

Just started to work on the opposite.

Hi @dishedee,

This is the plugin. Have a look at line 14/15:

// EXTEND HERE: Tags to remove, it uses their titles
var tagsToRemove = ["TagA", "TagB"];

That‘s where you should put in the titles of your project tags that should be removed. You mentioned you‘d change it if needed so I assume you know how to modify that array that it uses just 1 or 3 or more tags.

In order to test it, I built in a safeguard. You‘ll find it in in line 37…. In the condition which projects to process I have added as a last condition to check for projects starting with ‚TEST -‘ only. If you‘ve tested it as I did a few times, you can remove that statement (… && project.name.startsWith(“TEST -”) …).

// Process projects with titles starting with 'TEST -'
flattenedProjects.forEach(function(project) {
   if ((project.status === Project.Status.Active || project.status === Project.Status.OnHold) && project.name.startsWith("TEST -")) {
      removeTagsInProject(project, removableTags);
   }
});

Best wishes, and I hope it helps you achieve to what you want.

RemoveInheritedProjectTags.omnifocusjs (1.6 KB)

1 Like