Skip to main content
ALVEGA2k
Participant
April 24, 2019
Question

Continue text to next frames

  • April 24, 2019
  • 1 reply
  • 330 views

Hi, I have a script that imports some text data from a file and an rtf document. The last portion I need is to thread the text onto the next page and place in the text frame. Until the end of document.

Here is the code:

var doc = app.activeDocument;

var file = File(app.activeDocument.filePath.fsName + '/NewUserInformation.txt'); 

file.open("r"); 

 

for(var i=0;i<1;i++) 

var User1 = file.readln(); //it reads line 1

for(var i=0;i<1;i++) 

var Title1 = file.readln(); //it reads line 2

}

for(var i=0;i<1;i++) 

var Email1 = file.readln(); //it reads line 3

}  

for(var i=0;i<1;i++) 

var userphoto = file.readln(); //it reads line 4

}

for(var i=0;i<1;i++) 

var userresume = file.readln(); //it reads line 5

}

app.activeDocument.textVariables.item ('User Name').variableOptions.contents = User1

app.activeDocument.textVariables.item ('User Title').variableOptions.contents = Title1

app.activeDocument.textVariables.item ('Email').variableOptions.contents = Email1

var f = new File(app.activeDocument.filePath.fsName + userphoto); 

doc.pages[0].rectangles[0].place(f, false); 

//Place formatted Resume

var fresume = new File(app.activeDocument.filePath.fsName + userresume); 

doc.pages[0].textFrames.add;

doc.textPreferences.smartTextReflow = true;

doc.textPreferences.limitToMasterTextFrames = false;

doc.pages[0].textFrames[0].place(fresume);

doc.pages.add();

doc.pages[0].textFrames[0].select;

//THIS IS WHERE I'VE BEEN TRYING TO SET TO FLOW TEXT ONTO NEXT PAGE AND FRAME AND LET TextReflow to do the rest

doc.textPreferences.deleteEmptyPages = true;

file.close();

This topic has been closed for replies.

1 reply

Inspiring
April 25, 2019

Make sure your document is set up for 1 page with the text frame on the master page as the primary text frame.

The master text frame on the page places the text

For the image you can:

a. create a rectangle on the page and place the image or you can

b. use a master page item for placing the image (rectangle on the master page)

c. place the image as an anchored item to the text

Have the document add a page at the end for the next page

I will be discussing this subject to some extent next Tuesday, April 30 (yourscriptdoctor.com/blogs)