To move the anchored text frame you have to move the character, that is representing the anchored object in your text flow.
If you select your anchored text frame, the parent of that will be the character to move.
Something like that should work:
var anchoredObject = app.selection; var characterToMove = anchoredObject.parent; var mainStory = characterToMove.parent; var indexOfFirstInsertionPoint = characterToMove.paragraphs.insertionPoints.index; characterToMove.move ( LocationOptions.BEFORE , mainStory.insertionPoints[indexOfFirstInsertionPoint-1] );
Did not test that with XML tagged contents.
Unfortunately when i move anchored objects this way all tags in moved anchored objects are removed.
When I duplicate object instead of move it - tags are preserved.
Is there any other way to move anchored objects?
(ID CC 2018)
There are methods move() and duplicate() for e.g. characters. That's it.
Try duplicate() and remove the original.