If you have only one custom frame per illustration and this frame is drawn with a special pen,
like in the examples attached, you should consider to select the lines of the frame by pen. E.g.:
SELECT IF pen is equal to "frames"
Next step would be to loop thru the selected elements with firstSelectedElement and nextSelectedElement,
and tell from the startPoints and endPoints which of line of the frame you got. E.g.
el = activeDoc.firstSelectedElement
el3 = el.nextSelectedElement.nextSelectedElement
y = el.line.startPoint.y
IF ( y=el.line.segment.endPoint.y )
# First line is vertical
IF ( y3=el3.line.segment.endPoint.y )
# Third line is also vertical
IF ( y>y3 )
# First line is right to third line ...