Save As jpg Script now saving with 'psd.jpg' how can I strip 'psd'
Hi,
I've been using a script that came from here:
var Name = activeDocument.name;
var jpegfile = new File('D:/folder1/folder2/' + Name);
SaveAsJPEG(jpegfile, 10);
function SaveAsJPEG(saveFile, jpegQuality){
var doc = activeDocument;
if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) doc.bitsPerChannel = BitsPerChannelType.EIGHT;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
and it works great, but I wanted to adapt it to a different file that's saved already as .psd file. So, I changed:
var jpegfile = new File('D:/folder1/folder2/' + Name);
to:
var jpegfile = new File('C:/users/me/Documents/folder2/' + Name);
The problem is now I'm left with '.psd.jpeg' as the file extension. Other than adding a Duplicate document action in a can't fix it. How do I strip '.psd'?
I've searched but, I'm dyslexic and the answers given to other questions seems very specific to their issue.
Thank you.
