The only time you can interrogate a stories' frames with a script is when it's formatted with InDesign. Inside an IDML file, there is one set of data describing text frames, and another that holds the entire story. Inside the IDML file, there is no way to tell how ID's formatting would be applied -- for that, you'd need to know all line breaks (for which you need to know the font size, paragraph spacing, applied styles ... etc.etc.etc.) and the specifics of the text frames (size, baseline settings, text inset, etc. etc. etc. etc.). InDesign is the program that applies the formatting.
All is not (quite) lost if your route is InDesign document -> IDML -> ... (where are your frame breaks). It should possible to put invisible markers into your InDesign file that carry over into IDML. I'd think of XML markers (but don't know how these get represented in IDML), stuff like notes (don't know either) or maybe index markers (again -- ?).
If *everything else* fails, you could insert "(Start Here)" and "(End Here)" in your text at the start and end of each text frame, in a really really tiny font and with no color ...