Here’s the story. I’m bringing in text from different files onto a template. I don’t how long the text is going to be, so I want to check to see if the last text frame overflows. If it does, I want to add a new page and add the overflow text to it. I’m able to make the new page, but I can’t get the story to continue to flow on the next page. One problem is that the new page itself doesn’t contain anything. Everything is on a master page. So, somehow, my script needs to find the right text frame from the master spread, and add the text to it on the newly created page. Please help if you can. Thank you.
I don’t have CS. Thought this issue was supposed to be fixed by now.
This will do it automatically if you need a quick fix.
http://www.emsoftware.com/products/inflow
If you want to script it, post the code you use to create new pages, add text box, connect box chain, etc, along with where you think things are going wrong.
Oops… inflow isn’t out for CS yet, according to EM’s site.
You probably need to resort to naming the frames. Assuming you’re not using facing pages, though, you could use something simple like this (changing from selection as required):
set x to choose file
tell application “InDesign CS”
tell document 1
set thisFrame to item 1 of selection
set theMaster to overridden master page item of thisFrame
set thestory to parent story of thisFrame
place x on thisFrame
repeat while overflows of thisFrame is true
make page at end
set newFrame to override theMaster destination page page -1
set previous text frame of newFrame to thisFrame
set thisFrame to newFrame
end repeat
end tell
end tell
–
Shane Stanley
Thank you everyone for the ideas, but I actually figured out a good way to do it. I did it this way
repeat until overflows of lastFrame = false
set newPage to make new page
tell newPage
set masterItems to master page items
set frameBounds to geometric bounds of item 1 of masterItems
set nextFrame to make text frame
set geometric bounds of nextFrame to frameBounds
end tell
set next text frame of lastFrame to nextFrame
set lastFrame to end text frame of TF
end repeat