Quantcast
Channel: Adobe Community : All Content - InDesign Scripting
Viewing all articles
Browse latest Browse all 8771

[JS] autoflow in 2 columns/textframes

$
0
0

Hello,

 

I read through this post, http://forums.adobe.com/message/2142563#2142563, to get myself started, but still can't manage the autoflow properly. The main trouble I have is that the catalogue's layout has two columns, which are set up as separate text boxes, linked together. So I need the autoflow to add a new page, two new text boxes, link them together, and link the first one to the second text box on the previous page; in additiong to if the second one still overflows, repeat the process.

 

This is my function, which is, of course, broken. I'm stull unsure as to how to refer to the last page in the document in the while statement (I've tried .pages.lastItem(), but get an object does not support method overflow error with that.

function flow (myDocument) {

while (myDocument.pages[1].textFrames[1].overflows) {
var myTextFrame1 = myDocument.pages.add().textFrames.add;
myTextFrame1.geometricBounds = [15, 14, 198, 62]
var myTextFrame2 = myDocument.pages.lastItem().textFrames.add;
myTextFrame2.geometricBounds = [15, 66, 198, 132]
myTextFrame1.nextTextFrame = myTextFrame2
myTextFrame1.previousTextFrame = myDocument.pages[1].textFrames[1]; }
}

My question is how do I refer to both the pages and textboxes in their respective arrays dynamically, so I can have the overflow check on the last text frame of the last page? As it stands the script will run, but adds pages forever, so I also assume my linking of the textframes is not working properly either, because the textframe in the while statement is always overflowing.

 

I'll keep trying at it and report back if I have a breakthrough. Otherwise I would really appreciate some guidance.

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 8771

Trending Articles