# Can't figure out how to move an anchored text frame out of another text frame via javascript

**URL:** https://forums.creativeclouddeveloper.com/t/cant-figure-out-how-to-move-an-anchored-text-frame-out-of-another-text-frame-via-javascript/7361
**Category:** InDesign
**Tags:** uxp
**Created:** [January 15, 2024, 3:51am UTC](https://forums.creativeclouddeveloper.com/t/cant-figure-out-how-to-move-an-anchored-text-frame-out-of-another-text-frame-via-javascript/7361 "2024-01-15T03:51:30Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![wildownes](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/wildownes/32/3291_2.png) [@wildownes](https://forums.creativeclouddeveloper.com/u/wildownes)
#### Post date: [January 22, 2024, 12:26am UTC](https://forums.creativeclouddeveloper.com/t/cant-figure-out-how-to-move-an-anchored-text-frame-out-of-another-text-frame-via-javascript/7361/11 "2024-01-22T00:26:19Z")

</div>

This also may help someone trying to move textframes that are inline… i’m sure it can be cleaner but thought i’d drop it here since i spent WAY to long on this

```auto
const { app, AnchorPosition } = require("indesign");
const doc = app.activeDocument
const outsideTextFrame = doc.textFrames.itemByName("outsideTextFrame");
const outsideTextFrame2 = doc.textFrames.itemByName("outsideTextFrame2");
const insideTextFrame = doc.textFrames.itemByName("insideTextFrame");
const insideTextFrameItem = outsideTextFrame.allPageItems[0];
const myInsertionPoint = outsideTextFrame2.insertionPoints.item(0);

// Do the things
insideTextFrameItem.anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;
insideTextFrameItem.anchoredObjectSettings.releaseAnchoredObject();
doc.allPageItems[0];

// Put it into another text frame
insideTextFrame.anchoredObjectSettings.insertAnchoredObject(myInsertionPoint, AnchorPosition.INLINE_POSITION);
doc.allPageItems[0];

```

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/cant-figure-out-how-to-move-an-anchored-text-frame-out-of-another-text-frame-via-javascript/7361)._
