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

link textFrames

Explorer ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

Hi Forum,

I have a small bit to link Text Frame between two pages....

var myDoc = app.activeDocument;

myDoc.pages[0].textFrames[0].nextTextFrame = myDoc.pages[1].textFrames[0];

but my intention is to link all the textFrames inside the document (total pages is 20 pages and each pages have textFrames unlinked to other pages).

Any possibilities.

thanks & regareds.

S..

TOPICS
Scripting

Views

661

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 2 Correct answers

Explorer , May 21, 2013 May 21, 2013

Hi Shilpa

You can do it by using the loop,

for(i=0; i<myDoc.pages.length-1;i++){

myDoc.pages.textFrames[0].nextTextFrame = myDoc.pages[i+1].textFrames[0];}

Suresh

Votes

Translate

Translate
Community Expert , Aug 13, 2023 Aug 13, 2023

HI @M.Hasanin,

The original code should not have anything failing due to the InDesign version. The only issue I see is the missing array index on the left hand side of the assignement and that may have been due to the forum software migration. The following code should work and is almost the same as the original answer

var myDoc = app.activeDocument
for(var i=0; i < myDoc.pages.length - 1; i++)
    myDoc.pages[i].textFrames[0].nextTextFrame = myDoc.pages[i+1].textFrames[0];

-Manan

Votes

Translate

Translate
Explorer ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

Hi Shilpa

You can do it by using the loop,

for(i=0; i<myDoc.pages.length-1;i++){

myDoc.pages.textFrames[0].nextTextFrame = myDoc.pages[i+1].textFrames[0];}

Suresh

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
Explorer ,
May 21, 2013 May 21, 2013

Copy link to clipboard

Copied

thanks so much suresh!

It works fine and better....

Here I wish to give you points.....

thanks..

shil....

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
Enthusiast ,
Aug 13, 2023 Aug 13, 2023

Copy link to clipboard

Copied

Hi!
This is updated one :

 

//Relink Unlinked TextFrames in Pages
var myDoc = app.activeDocument;

for (var i = 0; i < myDoc.pages.length - 1; i++) {
  var currentPage = myDoc.pages[i];
  var nextPage = myDoc.pages[i + 1];

  var currentTextFrame = currentPage.textFrames[0];
  var nextTextFrame = nextPage.textFrames[0];

  currentTextFrame.nextTextFrame = nextTextFrame;
}

 

 

Best
Mohammad Hasanin

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 ,
Aug 13, 2023 Aug 13, 2023

Copy link to clipboard

Copied

HI @M.Hasanin,

The original code should not have anything failing due to the InDesign version. The only issue I see is the missing array index on the left hand side of the assignement and that may have been due to the forum software migration. The following code should work and is almost the same as the original answer

var myDoc = app.activeDocument
for(var i=0; i < myDoc.pages.length - 1; i++)
    myDoc.pages[i].textFrames[0].nextTextFrame = myDoc.pages[i+1].textFrames[0];

-Manan

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
Enthusiast ,
Aug 14, 2023 Aug 14, 2023

Copy link to clipboard

Copied

LATEST

@Manan Joshi 
Thanks , i forget to examine it correctly , thank you for the correction

Best
Mohammad Hasanin

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