how to truncate the file name in this script
I found this "oldie but goodie" script and it is performing very well except the name of the PDF it produces includes the .indd
for example Test.indd will create a PDF named Test.indd.pdf
how do i rework this so it will produce a name like Test.pdf
thank you
scott
//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 pdfName = d.name+"_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();
};