Can this be Automated?

I don’t know the first thing about writing Automation scripts, so I’m writing to ask if it’s possible to write an Automation script that will solve this problem.

Problem: In an outline with multiple levels, I have a column with #tags. I’d like to filter the view to show me only those items - PLUS their descendants - that have certain tags. Here’s the outline:

If I just run a Search/Filter I will get an outline with only those top-level items that have the tags in the Tags column, but none of the descendant items. So that doesn’t work for me.

If I run a Search/Batch Find, the main window doesn’t change, but I get in the Sidebar a list of those items with the tags. Let’s say for the sake of this discussion, it returns two results.

NOW … if I click on the first item in the sidebar, then choose View/Focus, I’ll get the first item and its descendants …

… and if click on the second item in the sidebar, it will add the second item and its descendants after the fist.

That’s what I’m looking for. By focusing on the first result and then clicking on the other results, I can get a view that shows me all the items that match the tag, with all their descendants.

Is there a way to script this? (I would need to do this for any tag, which could return any number of results.)

Thank you in advance for any help you might be able to offer. This issue - filtering an outline to show all the descendants of the filtered items - is a huge issue that I’ve yet been unable to solve.