Link all text frames in document

Explorer ,
Mar 20, 2019 Mar 20, 2019

Copy link to clipboard

Copied

Hi everyone!

Anyone knows how to link all the text frames (Thread) in document and what is the best way to do that?

Can I create the text frames on master spread and then link all of the the in the document? Or should I create the directly on the document pages?

And before that, how can I link all of them?

Thanks in advance!

TOPICS
Scripting

Views

1.2K

Likes

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
Advocate ,
Mar 25, 2019 Mar 25, 2019

Copy link to clipboard

Copied

Hello diogo,

 

If your document has multiple pages and each pages has only single text frame of size of type area.

Assuming this, you can use this below code to link these textFrames as follows:

 

//// Assuming Every Page has only one main textFrame ---

var myDoc = app.documents[0];

var allPages = myDoc.pages;

var currentFrame = allPages[0].textFrames[0];

for(var i = 1; i < allPages.length; i++){

    currentFrame.nextTextFrame = allPages.textFrames[i];

    currentFrame = allPages.textFrames[i];

    }

 

Best

Sunil

Likes

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 Beginner ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

Hi,

this would save my life.
I'm on the latest Indesign version and unfortunately I'm getting this error: "object does not support the property or method 'textFrames'" on string 6  'currentFrame.nextTextFrame = allPages.textFrames[i];'

 

Please help!

 

Likes

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 ,
May 11, 2022 May 11, 2022

Copy link to clipboard

Copied

There are a few problems with Sunil's script. The error you got was caused by the fact that allPages is a collection, and collections don't have the textFrame property.

If the conditions are the same as Sunil assumed (a single text frame on each page), you can use this code:

pages = app.documents[0].pages.everyItem().getElements();
thread = pages[0].textFrames[0];
for (i = 1; i < pages.length; i++) {
  thread.endTextFrame.nextTextFrame = pages[i].textFrames[0];
}

 P.

Likes

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 Beginner ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

That's just perfect, it helped me big time!

Thank you so so much,

EL

 

Likes

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 Beginner ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

Hello Peter, how do I modify the script for two text frames on each page? If there's more than one only every second frame is linked.

 

 

Bildschirmfoto 2022-09-02 um 12.59.36.jpg

Likes

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 Beginner ,
Sep 02, 2022 Sep 02, 2022

Copy link to clipboard

Copied

LATEST

Never mind, Peter. I searched a little more and found this free script that does the job. https://www.rorohiko.com/wordpress/indesign-downloads/textstitch/

Likes

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
Advocate ,
Mar 25, 2019 Mar 25, 2019

Copy link to clipboard

Copied

Otherwise only if you want to link two frames,

you can use this code.

firstTextFrame.nextTextFrame = secondTextFrame;

Best

Sunil

Likes

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