I'm trying to add a new feature to my script...
this is part of a larger script that will make two pdf. the user can select from their presets or customize the pdf
I then basically rerun the same snippet to give the user an opportunity to create another pdf (Low resolution proof & high res final art).
I want to have the dialog box open with the most common option preselected.
currently it comes up with the most recently used preset preselected.
this is what i have tried...
=======================================================================================
// your preset name
var pdfPreset = app.pdfExportPresets.itemByName("smallest size_spreads");
if (!pdfPreset.isValid) {
alert("Your preset doesn’t exist!");
exit();
}
while(app.documents.length>0){
var d=app.activeDocument;
};
else{
alert("Please open a document to execute export to pdf. Script will be aborted.");
exit();
}
if(d.saved == false){
alert("Save your document first before executing export to pdf. Script will be aborted.");
exit();
};
var pdfPath = Folder.selectDialog("Folder to save LOW RES pdf:");
var pdfName = d.name.substring(0, d.name.indexOf("."))+"_lr.pdf";
var userDefFileName = prompt("File name:",pdfName,undefined);
if(userDefFileName == null){
exit();
};
var pdfFullName = pdfPath+"/"+userDefFileName;
if(File(pdfFullName).exists){
c=confirm("The PDF-file \""+userDefFileName+"\" is already existing. Do you want to overwrite it?",true,undefined);
if (c==0){exit()};
};
//Error-handling if PDF file override is on and PDF is already opened in an PDF reader app:
try{
d.exportFile(ExportFormat.PDF_TYPE,File(pdfFullName),true,undefined,pdfPreset);
}catch(e){
alert("Error:\r"+e.message+"\r\r(Line "+ e.line+" in script code.)");
exit();
};