InDesign - Getting all text frames of a selection with groups

Is there any easy way to get all of the text frames of a selection, even if the selection includes loose text frames and also groups of grouped text frames and other elements?

I wish it was this simple: “set allTextFrames to object reference of every text frame of selection”

Obviously this will not work because it would not account for any text frames within a group or within a group of another group, and so forth.

Any help or place to look would be much appreciated.


I think it’s bad form to pose duplicates of questions that are already live on the forum. Follow up questions should live in the original post. If you put forth the effort to tinker around with the answer already provided, you should find it can be easily adapted to your needs with a single repeat loop.

You are correct Marc, I am sorry about that. Believe me, if it were easy for me I wouldn’t have done this. I actually spent hours. My struggle was when there were many groups inside of groups. I couldn’t get it to iterate past one group level very well. I will try harder and see what I can come up with.