I’m wanting to capture the current document name in two variables, then change the extension in one.
What I’ve done thus far (snipped below) doesn’t succeed at changing the second variable.
Commenting in the script below tells what I’m trying to do.
Do you more experienced scripters see where I’m going astray?
(one area I’m looking at in line 7, but haven’t been able to resolve, is should the replace include /indd$ instead of indd, and should the ps be in quotes?)
// set both variables to active document name
var myDocName1 = document.name;
var myDocName2 = document.name;
// confirm the two variables in a simple alert
alert(“Test result 1 ” + myDocName1 + ” and ” + myDocName2);
// change the variable to replace indd with ps. This will be used in a later
// printFile = “/Seps to PDF/” + myDocName2;
myDocName2.replace(‘indd’, ‘ps’);
alert(“Test result 2 ” + myDocName1 + ” and ” + myDocName2);
// current result is myDocName2 remains unchanged