with doc.textFrames you would not find nested text frames (grouped, pasted inside or anchored ones).
Why don't you use InDesign's Preflight feature?
You could go to the text frames that overflow from notified errors immediately.
What do you mean by "add tag"?
Apply a fill color to the one that overflows or something?
Preflight is good, but there're over 300 errors
1 person found this helpful
you could loop all stories of the document.
Here an example, that will work for all text frames, nested in groups or pasted inside graphic frames or anchored to text.
You just have to add code to do something with the found ones.
In my example I will just fill the found ones with color Magenta. Or in case of found textPaths, I also change the color of the stroke.
That is not exactly what you want. But you can add your own code to the function doSomethingWithTextContainers() .
Read my comments in the script carefully. The script's action can be undone in one go.