A fun project
If you enable the last line (remove the // comment slashes), you automatically get the Export PDF dialog. This, however, makes it skip the Save As dialog -- I don't know how to do both!
Either way, you should be seeing the selected page ranges in the Export Range dialog.
var mCheckbox = [];
var expMasterDialog = app.dialogs.add({name:"The Export Master", canCancel:true});
with (expMasterDialog){
with(dialogColumns.add()){ for (i=0; i<app.activeDocument.masterSpreads.length; i++) { with(dialogRows.add()) { mCheckbox[i] = checkboxControls.add({staticLabel:app.activeDocument.masterSpreads[i].name,checkedState:false}); } }}}if (expMasterDialog.show() == true){
newRange = '';for (i=0; i<app.activeDocument.pages.length; i++){ if (app.activeDocument.pages[i].appliedMaster && mCheckbox[app.activeDocument.pages[i].appliedMaster.index].checkedState == true) { if (newRange) newRange += ','; newRange += app.activeDocument.pages[i].name; }}
app.pdfExportPreferences.pageRange = newRange;// alert (newRange);// app.activeDocument.exportFile (ExportFormat.PDF_TYPE, File((app.activeDocument.fullName.fsName+'!').replace(/(\.indd)?!$/i, '.pdf')), true, app.pdfExportPresets[0]);}