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

Re: Script to open INDD files, run script, and close

$
0
0

Here's my whole code if it helps. I'm wondering if the script is moving too fast. I think that the first files are still PDFing while the others are opening and closing. Could that be it? I'm not sure why else the for loop for the PDFing is only working on the first file.

 

var myFolder = Folder.selectDialog("Select Input Folder");

var myIndsnFiles = myFolder.getFiles("*.indd");

var exportPath=Folder("/").selectDlg("Select PDF output folder:");

var pdfPreset = "Press Quality";

 

for(k=0; k<myIndsnFiles.length; k++)

{

    app.open(myIndsnFiles[k]);

    var jobNumber = "12345";

        for (aPage=0; aPage < app.activeDocument.pages.length; aPage++)

        {

            app.pdfExportPreferences.pageRange = app.activeDocument.pages[aPage].name;

            app.activeDocument.exportFile (ExportFormat.PDF_TYPE, File(exportPath+"/"+jobNumber+"_"+pad(app.activeDocument.pages[aPage] .name)+".pdf"), false, pdfPreset);

 

            function pad (n) {

            return ("00000"+n).slice(-3);

            }

        }

 

app.activeDocument.close();

 

}


Viewing all articles
Browse latest Browse all 37788

Trending Articles



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