Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Naming PDF using para.style applied

$
0
0

Hi Forum!

 

Could any body tweak on this script.please.

 

while runnig this script, i could able to export PDF. The pdf naming will be the contents inside the document on everypage, on which paragraphStyle "Title" is applied.

 

The problem is, if the pargraphStyle "Title" is applied twice a time in a same page, the pdf is produced twice a time for the same page likewise so on.

 

eg. The paragraphStyle "Title" is applied for the content "XYZ" on page 1, and for the content "123" on page 2.

 

Result of this 4 pdf are produced. XYZ_1.pdf, XYZ_2.pdf and 123_1.pdf adn 123_2.pdf..  My necessary is to have pdf produced only one time for a content which has "Tittle" paragraphstyle applied.

 

app.findGrepPreferences = null;

app.findGrepPreferences.appliedParagraphStyle = "Title";

 

result = app.activeDocument.findGrep();

 

while (result.length)

{

   str=result.pop();

 

 

var myDoc = app.activeDocument;

app.findGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences = NothingEnum.nothing;

  app.findGrepPreferences.findWhat =str.contents;

 

var myFind  = myDoc.findGrep();

for(var a=myFind.length-1; a<=0; a++){

 

     myFinds = myFind[a];

     }

for(var myCounter = 0; myCounter < myDocument.pages.length;

myCounter++){

myPageName = myDocument.pages.item(myCounter).name;

app.pdfExportPreferences.pageRange = myPageName;

 

var myRegExp = new RegExp(":","gi");

myPageName = myPageName.replace(myRegExp, "_");

myFilePath = myFolder + "/" + myFinds.contents + "_"+ myPageName + ".pdf";

myFile = new File(myFilePath);

myDocument.exportFile(ExportFormat.pdfType, myFile, false);

}


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>