Rename file as part of Bridge script
Hello. I have a simple script that I would like to modify to rename the images sequentially as they are processed. If anyone can give me a hint how to rewrite
var saveFile = new File(docPath+'/'+targetName+'.jpg');
to
var saveFile = new File(docPath+'/'+'MyStaticText' + Two Digit Serial Number +'.jpg');
I would really appreciate the help. Here is the full original script:
///#target photoshop
/// Save for Webshow
/// Set JPGquailty. Can be 1 - 12.
var JPGquality = 8;
/////////////////////////////////////////////////////////////////////////
if(documents.length){
var docPath='';
var docName='';
var parentName='';
var grandName='';
try{
docName = activeDocument.name;
docPath = activeDocument.path.parent + "/WebshowUpload/images";
var arrayPath = activeDocument.path.toString().split('/');
if (arrayPath.length > 2)
{
parentName = arrayPath[arrayPath.length-1];
grandName = arrayPath[arrayPath.length-2];
}
}
catch(e){
docPath = new Folder("~/desktop");
docName = activeDocument.name + '.jpg';
}
var docNAME = docName.split('.');
var targetName = docNAME[0];
var saveFile = new File(docPath+'/'+targetName+'.jpg');
SaveJPEG(saveFile, JPGquality)
}
// Save Webshow Thumbnail
doAction("01_ResizeThumbnail","Wedding_ConvertForWebshow");
/// Set JPGquailty. Can be 1 - 12.
var JPGquality = 8;
/////////////////////////////////////////////////////////////////////////
if(documents.length){
var docPath='';
var docName='';
var parentName='';
var grandName='';
try{
docName = activeDocument.name;
docPath = activeDocument.path.parent + "/WebshowUpload/tn";
var arrayPath = activeDocument.path.toString().split('/');
if (arrayPath.length > 2)
{
parentName = arrayPath[arrayPath.length-1];
grandName = arrayPath[arrayPath.length-2];
}
}
catch(e){
docPath = new Folder("~/desktop");
docName = activeDocument.name + '.jpg';
}
var docNAME = docName.split('.');
var targetName = docNAME[0];
var saveFile = new File(docPath+'/'+targetName+'.jpg');
SaveJPEG(saveFile, JPGquality)
}
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
//FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality; //1-12
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
}
In other words, the resulting images should be MyStaticText01.jpg, MyStaticText02.jpg, MyStaticText03.jpg, etc. Thanks.
