-
1. Re: Script to open INDD files, run script, and close
BEGINNER_X Aug 12, 2013 11:23 AM (in response to erblo007)HI erblo007,
Use the below code may it will helpful for you..
var myFolder = Folder.selectDialog("Select Indesign Folder"); var myIndsnFiles = myFolder.getFiles("*.indd"); for(k=0; k<myIndsnFiles.length; k++) { app.open(myIndsnFiles[k]); //Write main part of your script here app.activeDocument.close(); }
If above coding help for you, then please click helpful or correct answers for me.
Thanks in advance
Beginner
-
2. Re: Script to open INDD files, run script, and close
erblo007 Aug 12, 2013 3:14 PM (in response to BEGINNER_X)Thanks Beginner, this is very close. This script opens all the INDD files but only runs the script on the first one. So, the first file gets processed correctly but the subsequent ones don't. Any ideas?
-
3. Re: Script to open INDD files, run script, and close
erblo007 Aug 12, 2013 11:17 PM (in response to BEGINNER_X)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();
}
-
4. Re: Script to open INDD files, run script, and close
csm_phil Aug 13, 2013 2:32 AM (in response to erblo007)Hi erblo007,
I ran the above script the out file comes as like this ( "12345_0001.pdf", "12345_0002.pdf", first file process correct, second file "12345_001.pdf", "12345_002.pdf") this your requirement or else?
thx,
csm_phil
-
5. Re: Script to open INDD files, run script, and close
erblo007 Aug 13, 2013 7:44 AM (in response to csm_phil)OK I realized that the script does work as needed! (My test files were all numbered 2-3, so it was overwriting).
This is just what I need, thank you!
-
6. Re: Script to open INDD files, run script, and close
Peter Kahrel Aug 13, 2013 8:06 AM (in response to erblo007)Right now I'm using the Batch convert script, to convert INDD to INDD and run the script in between (then I delete the extra INDD file). But I'm trying to eliminate the conversion element, just need the script part of it.
Just for the record, when you use that batch convert script the way you do, it's really a batch processor. If you apply the script in CS6 to CS6 documents, naturally no conversion takes place.
When you say 'then I delete the extra INDD file', you probably save that InDesign files to a different folder. Just use the same folder for input and output.
But anyway, you found a working solution.
Peter