• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
7

How to select anchored textframes and move its contents to main story in a document

Engaged ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

I need to select anchored textframes and should move its content to main story without removing or deleting the anchor. If it was deleted or removed contents are not getting inside main story. But i dont know how to select the anchored textframe itself. Please help me with this one. Also I am trying this way. Is there any other other way to move its content to main story without affecting the anchored frame.

 

Manually if we select the anchored xml element and drag it outside the menu, the contents of that anchored frame is moving away from anchored frame is it possible to do it via scripting??

 

TOPICS
How to , Scripting

Views

263

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 04, 2023 Oct 04, 2023

Because i dont know how to select anchored object frame

 

Well, like you did: click it, and app.selection[0] is your anchored frame.

 

But if you want to process a story with many anchored frames, select a frame of the story that contains the anchored frames and run this script:

 

anchoredFrames = app.selection[0].parentStory.textFrames.everyItem().getElements();
for (i = anchoredFrames.length-1; i >= 0; i--) {
  anchoredFrames[i].parentStory.move (
    LocationOptions.BEFORE,
    anchoredFram
...

Votes

Translate

Translate
Engaged ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

I am trying it using indesign javascript! please provide solution in javascript

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Select the text with the text tool and cut it into the pasteboard, insert the text to the target place and paste. If you want to paste without formatting it is a different command.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

An anchor's parent is a character. So all you need to do is to move the anchored frame's content to before or after the anchor's parent.

 

Given a text frame that contains an anchored frame, select the text frame and run this script:

 

a = app.selection[0].textFrames[0];

a.parentStory.move (
  LocationOptions.BEFORE,
  a.parent);

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

It shows object is invalid! But when i do as below only with selection it was working. Actually it seems to be object textFrame, How to select all anchored object textframe one by one and move its contents as you said!

a = app.selection[0];
a.parentStory.move (
  LocationOptions.BEFORE,
  a.parent);

 Because i dont know how to select anchored object frame, Please help me in this case

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Because i dont know how to select anchored object frame

 

Well, like you did: click it, and app.selection[0] is your anchored frame.

 

But if you want to process a story with many anchored frames, select a frame of the story that contains the anchored frames and run this script:

 

anchoredFrames = app.selection[0].parentStory.textFrames.everyItem().getElements();
for (i = anchoredFrames.length-1; i >= 0; i--) {
  anchoredFrames[i].parentStory.move (
    LocationOptions.BEFORE,
    anchoredFrames[i].parent
  );
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

LATEST

Thank you very much @Peter Kahrel ! working fine

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines