Copy link to clipboard
Copied
Hi. I am working on a script hat places articles from text files. The first 4 lines contain information about the service that provides the article.
Is there any method that wiil ignore or remove the first 4 paragraphs when placing the text?
I would suggest placing the text files and just removing the unnecessary paragraphs (line breaks). Example below which is rather simplistic but hopefully will get you down the right path. Just select the text frames and remove paragraphs by range.
var doc = app.activeDocument;
var myFile = "/c/test/myTxtFile.txt";
var myTxf = doc.pages.item(0).textFrames.item(0);
myTxf.place(File(myFile));
myTxf.paragraphs.itemByRange(0,3).remove();
Copy link to clipboard
Copied
Look into BEFORE_PLACE and AFTER_PLACE events
Copy link to clipboard
Copied
I would suggest placing the text files and just removing the unnecessary paragraphs (line breaks). Example below which is rather simplistic but hopefully will get you down the right path. Just select the text frames and remove paragraphs by range.
var doc = app.activeDocument;
var myFile = "/c/test/myTxtFile.txt";
var myTxf = doc.pages.item(0).textFrames.item(0);
myTxf.place(File(myFile));
myTxf.paragraphs.itemByRange(0,3).remove();
Copy link to clipboard
Copied
Thanks, that worked like a charm.
Copy link to clipboard
Copied
I must have been very tired when I completely misread your question ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more