Question
Photoshop script saving result in file Javascript
Hi
I'm a total noob in term of javascript, but i find it really useful to ease some redundant task in photoshop,
Here is my question : I'd like to pick one file (in the folder A) and add a suffix to it to gain some time (and nerves). I'd also like for it to be saved in an other folder (in the folder B) and here is the problem... Here is the code that I have :
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
try {
var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var thePath = myDocument.path;
}
catch (e) {
var theName = myDocument.name;
var thePath = "~/Desktop/VHigh"
};
var theSuffix = " - HD";
// duplicate;
var myDocument = app.activeDocument.duplicate("theCopy", true);
// jpg options;
var jpgopts = new JPEGSaveOptions();
jpgopts.embedProfile = true;
jpgopts.formatOptions = FormatOptions.STANDARDBASELINE;
jpgopts.matte = MatteType.NONE;
jpgopts.quality = 10;
myDocument.saveAs((new File(thePath+"/"+theName+theSuffix+".jpg")),jpgopts,true);
// close;
myDocument.close(SaveOptions.DONOTSAVECHANGES);
};
I think it has something to do with "myDocument.saveAs((new File(thePath+"/"+theName+theSuffix+".jpg")),jpgopts,true);" but i don't know what to do..
Thanks
