Hi, Replace ".indd" to "" or get substring from the name. //ExportPDF_in_Foreground.jsx //Uwe Laubender /** * @@@BUILDINFO@@@ ExportPDF_in_Foreground.jsx !Version! Wed Jun 23 2010 17:08:10 GMT+0200 */ //DESCRIPTION:PDF-Export in foreground (old school like in InDesign CS4) if(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 docName = d.name; docName = docName.substring(0, docName.lastIndexOf(".indd")) var pdfName = docName + "_LOW.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,undefined); }catch(e){ alert("Error:\r"+e.message+"\r\r(Line "+ e.line+" in script code.)"); exit(); };
... View more