Of course that presumes both of these threaded frames need to be anchored to the same spot, and that the text is threaded only between the two of them. You cannot thread text from one anchored frame into a different anchored frame in a new location, nor to unanchored text. And it can be darned hard to select the anchored group after pasting if it goes into overset.

That will depend on the anchoring settings of every individual text frame in the story.

If x/y distance of all three are set relative to the text frame where the anchor lives, yes. They will move along with that frame. If they are relative to the insertion point of the anchor, they will move along with the text.

That means use insertion point 1 of the object that is stored in variable A, and that is the text frame I named "A" in my explanation.

So to say the target, you need to select first. ExtendScript's counting begins with number zero.

If you want a different insertion point (counting on) you could use a different number between the brackets.

Or count from back to forth by using [-1] or [-2].

[-1] would be the last insertionPoint in the text frame, [-2] the one before the last one.

But the script will break, if you determine a number that does not exist.

For practical reasons this script needs something like an UI so the user could determine something like:

Anchor should be at the beginning, after first, after third word etc.

Sure, the best thing would be to start out from a text selection. But we cannot do that, because you simply cannot select some text plus a page item you want to anchor at one time. Maybe with an event driven script… Hm. I have to think about this…

One could always drag a piece of text (one anchor, all anchors) to a different insertion point in the text. I say drag, notcopy/paste. Copy/paste will break the threaded story. All you need is to enable "Drag and Drop Text Editing" in the preferences of InDesign. That's under the "Type" pane… Then select the piece of text and drag it to the new position in the story.