Copy link to clipboard
Copied
Dear Community,
I have been using Indesign since CS2 and I have never came across this particular problem before. I am hoping someone here can help me. I have 7 seperate indesign documents each from a data merge. Each document has close to 300 pages. What I need is very simple but for the life of me I cannot figure out how to do it efficiently. I need to export multiple page ranges for each indesign document and have each range be a seperate pdf. Here's an example of what I mean.
Indesign Document:
1-2, 4-5, 7-16, 18-19, 21-30, 32-35, 37-38, 40-49, 51-52, 54-57, 59-74, 76-79, 81-82, 84-85, 87-92
I need a way to export so that basically the comma means *NEW PDF*.
The only way I found so far to do this is to manually export the ranges 1 at a time which takes literally hours to go through each id file OR I found 1 plugin this morning that may do it called "extract Pages".
https://www.id-extras.com/products/extract-pages/
There's got to be an easier way right? I shouldn't have to spend $50 to do this seemingly insanely simple export.
Any ideas guys?
Thanks!
(Sorry, didn't mean to leave you hanging. I must be in a different time zone -- my original answer was done right before closing down for the night.)
I've found your bug -- and it's actually toted as a "feature". My Mac had no problems with the script but I get your error on my Windows 'chine as well. Apparently the default location to save in, if no path has been given, is the scripts folder. I didn't notice because my Mac automatically opened the files as they were created and I just glanced a
...The exportFile method needs a file path, which was not included in the code I pasted from jongware’s first post. Maybe this:
makeDialog();
var pp, pglist;
function makeDialog(){
var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
with(theDialog.dialogColumns.add()){
staticTexts.add({staticLabel:"Export Preset:"});
staticTexts.add({staticLabel:"Page Range:"});
}
with(theDialog.dialogColumns.add()){
pp = dropdowns.add({str
Copy link to clipboard
Copied
It's a good solution for better use of the script. Thanks a lot for the suggestion!
Copy link to clipboard
Copied
Another good idea, though it might make the list in the scriopts forlder a bit long if there are a lot of presets.
Copy link to clipboard
Copied
Old topic, but it anyone is still working on this, I would suggest the a good way to handle @LMatiel 's request would be to implement a dropdown box to select a preset rather than trying to choose each setting, but perhaps that was what they meant.
Copy link to clipboard
Copied
Thanks for the reply, there is another script that contains the dropdown menu with all the pdf settings that are saved in indesign but I can't get it to work in osx
Here
Copy link to clipboard
Copied
Sorry, I'm not a scripter so can't help with that. See you posted in the other thread, so perhaps the author will get back to you there.
Copy link to clipboard
Copied
Hi @LMatiel , Try this:
makeDialog();
var pp, pglist;
function makeDialog(){
var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
with(theDialog.dialogColumns.add()){
staticTexts.add({staticLabel:"Export Preset:"});
staticTexts.add({staticLabel:"Page Range:"});
}
with(theDialog.dialogColumns.add()){
pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().name, selectedIndex:3, minWidth:80});
pglist = textEditboxes.add({editContents:"", minWidth:350});
}
if(theDialog.show() == true){
pp = app.pdfExportPresets.item(pp.selectedIndex);
pglist = pglist.editContents.split(',');
for (i=0; i<pglist.length; i++){
app.pdfExportPreferences.pageRange = pglist[i];
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File('pages_'+pglist[i]+'.pdf'), false, pp);
}
theDialog.destroy();
}
}
Copy link to clipboard
Copied
@rob day Thanks for the reply, I installed the script and ran it, it shows me all the settings to choose from that I need but when I want to generate the PDF it shows me this alert
Copy link to clipboard
Copied
Copy link to clipboard
Copied
These are the screenshots of the process
Copy link to clipboard
Copied
Hi, I'm learning scripting so very much a newbee. When run this script, the final pdf's that are exported are named the page range value. Is there a way to have the page range be a suffix added to the filename?
Thanks for any help or direction you might be able to give.
Copy link to clipboard
Copied
The exportFile method needs a file path, which was not included in the code I pasted from jongware’s first post. Maybe this:
makeDialog();
var pp, pglist;
function makeDialog(){
var theDialog = app.dialogs.add({name:"Choose a Preset", canCancel:true});
with(theDialog.dialogColumns.add()){
staticTexts.add({staticLabel:"Export Preset:"});
staticTexts.add({staticLabel:"Page Range:"});
}
with(theDialog.dialogColumns.add()){
pp = dropdowns.add({stringList:app.pdfExportPresets.everyItem().name, selectedIndex:3, minWidth:80});
pglist = textEditboxes.add({editContents:"", minWidth:350});
}
if(theDialog.show() == true){
pp = app.pdfExportPresets.item(pp.selectedIndex);
pglist = pglist.editContents.split(',');
var path = app.activeDocument.fullName.path;
for (i=0; i<pglist.length; i++){
app.pdfExportPreferences.pageRange = pglist[i];
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File(path+'/pages_'+pglist[i]+'.pdf'), false, pp);
}
theDialog.destroy();
}
}
Copy link to clipboard
Copied
@rob day Thank you very much and I apologize that I couldn't test it before, it works perfectly, the script allows you to select the page range to generate the pdfs and the corresponding settings. It saves the file in the same place where the .indd is, it doesn't allow you to choose another location.
It works correctly, thank you very much!!!
Copy link to clipboard
Copied
Change the following line to this:
app.activeDocument.exportFile(ExportFormat.PDF_TYPE, File('pages_'+ app.activeDocument.name.replace(/\.indd/gi,"") + "_" + pglist[i]+'.pdf'), false, pp);
Copy link to clipboard
Copied
Jongware said:
…I checked on my Windows machine and indeed it tries to store the files in the Scripts folder, which is inside a "protected folder" (a Microsoft "feature", so not a bug ...). …
Was this the Application folder of your Scripts panel?
Then I'd try to store the script in the User folder of the Scripts panel.
Regards,
Uwe Laubender
( ACP )