This needs more words. And perhaps a few images: do it by hand, and show the difference before/after.
Try this code!!!
var myDoc = app.activeDocument; var myTextFrame = myDoc.textFrames.everyItem().getElements(); var ins=app.activeDocument.textFrames.item(0).insertionPoints.item(2); var Rec = ins.rectangles.add(); Rec.geometricBounds = ["4p","3p", "10p", "10p"]
I understood what he is talking about. He wants to cut unanchored text frame or unanchored object into the text frame.
if your version of InDesign is CS5.5 or above you can use the method insertAnchoredObject() of the anchoredObjectSettings of your rectangle. The method requires two arguments: storyOffset and anchoredPosition . storyOffset is an insertionPoint, one in your textFrame you like the rectangle to be anchored with, anchoredPosition is the kind of anchoring you like to do: inline, above line or anchored expressed with enumerators.
Have two objects on page 1 of your document.
A rectangle and a text frame.
var rectangle = app.documents.rectangles; var textFrame = app.documents.textFrames; // Anchor the rectangle inline at the first insertion point of the text frame: rectangle.anchoredObjectSettings.insertAnchoredObject( textFrame.insertionPoints , AnchorPosition.INLINE_POSITION );
See also DOM documentation here: