This forum was recommend by a user on the dpReview Retouching forum as a possible source of help.
I'm not a scripting expert (or even close) but this seemed like an easy project.
In PSCS, I want to save an open image to jpg in a different but nearby directory. For example, the file 08302005-Test-001.crw opened from C:\blahblah\RAW is the active image in PSCS, I wanted a script to save a file 08302005-Test-001_V0.jpg in C:\blahblah\Develops (i.e., up one parent directory level from \RAW and then down the same generic directory tree to \Develops)
I think I've got the filename issues worked out but can't get the directory structure issues resolved. Can someone offer a few hints or a better approach (I don't want a batch action ... this is a for the active file only).
Here is my script:
var AD=activeDocument;
var imgName= AD.name;
imgName = imgName.substr(0, imgName.length -4); // removes .psd
saveFile = new File("//../Develops/"+imgName+".jpg"); // saving as jpg with _v0 added to name
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 10; // quality level 10
AD.saveAs(saveFile, saveOptions, true, Extension.LOWERCASE);
I do have the script working in a specific folder structure but I just can't get it to go up one level and back down the a tree in the generic sense, even when the branches are named the same.
blahblah/ <- can't make this generic
RAW/ <- can work here and save to Develops
Develops/
Help Request: Simple JPEG Save Script
Help Request: Simple JPEG Save Script
cal516 wrote:I think I've got the filename issues worked out but can't get the directory structure issues resolved. Can someone offer a few hints or a better approach (I don't want a batch action ... this is a for the active file only).
Here is my script:
var AD=activeDocument;
var imgName= AD.name;
imgName = imgName.substr(0, imgName.length -4); // removes .psd
[saveFile = new File("//../Develops/"+imgName+".jpg"); // saving as jpg with _v0 added to name
This is the problem line, of course. What you want is more like:
Code: Select allsaveFile = new File(AD.fullName.parent.parent + "/Develops/"+imgName+".jpg");
The relative path notation basis it resolution on the "current" path. I normally don't rely on the current path unless I have set it deliberately myself in code.
ciao,
-X
Here is my script:
var AD=activeDocument;
var imgName= AD.name;
imgName = imgName.substr(0, imgName.length -4); // removes .psd
[saveFile = new File("//../Develops/"+imgName+".jpg"); // saving as jpg with _v0 added to name
This is the problem line, of course. What you want is more like:
Code: Select allsaveFile = new File(AD.fullName.parent.parent + "/Develops/"+imgName+".jpg");
The relative path notation basis it resolution on the "current" path. I normally don't rely on the current path unless I have set it deliberately myself in code.
ciao,
-X