Question
Change column break or page break characters to carriage returns
Hi
I'm trying to create a script that will copy all text from articles and put it together in one single text box in another document. I need it to take the styles over with it. The problem I'm having is replacing any column break characters with ordinary returns. This sounds like it should be simple but nothing seems to work!
Thank you for any help
Here's my thinking so far
var sourceDoc = app.activeDocument;
function collectText() {
var articleList = sourceDoc.articles.everyItem().articleMembers.everyItem().itemRef
var destDoc = app.documents.add();
destDoc.documentPreferences.facingPages=false;
//destDoc.layoutWindows[0].screenMode = 1936552048;
for(var i = 0; i < articleList.length; i++) {
if (articleList[i].parentStory.characters[-1].contents !== '\r') {
articleList[i].parentStory.insertionPoints[-1].contents = "\r";
} else if (articleList[i].characters[-1].contents == SpecialCharacters.FRAME_BREAK) {
articleList[i].insertionPoints[-1].contents = "\r";
}
articleList[i].parentStory.texts.everyItem().select()
app.activeDocument = sourceDoc
app.copy()
app.activeDocument = destDoc
if (!myTextFrame) {
var myTextFrame = destDoc.textFrames.add ();
myTextFrame.geometricBounds = destDoc.pages[0].bounds;
}
myTextFrame.parentStory.insertionPoints[-1].select();
app.paste();
while (myTextFrame.overflows) {
var myPrTextFrame = myTextFrame;
var myPage = destDoc.pages.add ();
var myTextFrame=myPage.textFrames.add ();
myTextFrame.geometricBounds = destDoc.pages[0].bounds;
myTextFrame.previousTextFrame=myPrTextFrame;
}
}
}
collectText();
