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();
}
}
... View more