I have a working script using .saveAs to save my current file as a PSD to a location on my computer. Although, it doesn't set the current working document to that newly saved PSD. The goal is to set the current document to the saved PSD and (from my research) the only way to do that is with action descriptors. I have the working code for saving TIFF file using action descriptors below:
function saveTIFF() {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putEnumerated( s2t( "byteOrder" ), s2t( "platform" ), s2t( "macintosh" ));
descriptor.putObject( s2t( "as" ), c2t( "TIFF" ), descriptor2 );
descriptor.putPath( c2t( "In " ), new File("/Users/geary/Desktop/newtifffile.tif") );
descriptor.putInteger( s2t( "documentID" ), 813 );
descriptor.putBoolean( s2t( "lowerCase" ), true );
descriptor.putEnumerated( s2t( "saveStage" ), s2t( "saveStageType" ), s2t( "saveSucceeded" ));
executeAction( s2t( "save" ), descriptor, DialogModes.NO );
}
For me, the culprit code that changes this from a TIFF save to a PSD save and making the active document the saved PSD, is the .putObject's 2nd argument showing c2t( "TIFF" ). I could be wrong there! Although, if I am correct, the next issue is the code to use for the "default" PSD Format. Per this document, is a list of Photoshop Constants. I picked out the ones specific to the phClassPhotoshop prefix, shown below:
phClassPhotoshopDCSFormat -> 1349010481 -> "PhD1" photoshopDCSFormat
phClassPhotoshopDCS2Format -> 1349010482 -> "PhD2" photoshopDCS2Format
phClassPhotoshop20Format -> 1349022770 -> "Pht2" photoshop20Format
phClassPhotoshop35Format -> 1349022771 -> "Pht3" photoshop35Format
phClassPhotoshopEPSFormat -> 1349022789 -> "PhtE" photoshopEPSFormat
phClassPhotoshopPDFFormat -> 1349022800 -> "PhtP" photoshopPDFFormat
I am unsure which one to proceed with if my presumtions are correct about the code. I was planning on choosing one and testing it out, but that still doesn't give validity of which code is the default PSD format.
I would immensley appreciate any help in figuring this out. Thank you, in advance, for your time and efforts.