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!
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
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!
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.
Copy link to clipboard
Copied
That's just perfect, it helped me big time!
Thank you so so much,
EL
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.
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
Otherwise only if you want to link two frames,
you can use this code.
firstTextFrame.nextTextFrame = secondTextFrame;
Best
Sunil