I get a general photoshop error saying my version of photoshop doesn't work with this. when I do an alert the path looks fine, and when I take out the variable "desName2" in the saveFile it saves no prob. I'm a bit confused why its giving me an error. any ideas?
Code: Select all
////////////////////////////////////
// JPG save options
////////////////////////////////////
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 9;
app.activeDocument = templateDoc;
var doc = activeDocument;
var is_file = /^([^.]+)[.]([A-Za-z]+)$/i;
//get name of file from JPG for save
var isa_file = /^([^.]+)[.]([A-Za-z]+)$/i;
app.activeDocument = documents[1];
var matches = is_file.exec(app.activeDocument.name);
app.activeDocument = documents[0];
var desNameMatch = isa_file.exec(app.activeDocument.name);
app.activeDocument = templateDoc;
var sansExtension = matches[1];
var extension = matches[2];
var desName = desNameMatch[1];
var desName2 = desNameMatch[1];
var outputFolder = Folder(outputFolder2+"/"+sansExtension); // save folder
if(!outputFolder.exists) outputFolder.create();
var saveFile = File(outputFolder+"/"+desName2+"/"+desName+".jpg");
alert (saveFile);
activeDocument.saveAs(saveFile, saveOptions, true, Extension.LOWERCASE);
save function error
save function error
sorry got it. I had to assign the variable to the folder and not file.