Hey everyone, been a while, I'm trying to update a portion of my code that worked in CS5, and now doesn't work in CS6.. EXR format is now included in CS6, and handles the alpha channel differently, basically it recognizes it now, as it didn't before. So I am using the script listener to try and create a simple variable to pass on at save time, and I'm having problems with it saving the .exr when I try to pass the variable for the file path through... for instance, if I run this code on a file with an alpha channel, (it has to be 32 bit or it will error out):
Code: Select allfunction saveEXR(archiveFile) {
var idsave = charIDToTypeID( "save" );
var desc14 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc14.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc14.putPath( idIn, new File( "L:\TF_testFile\TF_testFile_red_a_v01.exr" ) );
var idDocI = charIDToTypeID( "DocI" );
desc14.putInteger( idDocI, 84 );
var idCpy = charIDToTypeID( "Cpy " );
desc14.putBoolean( idCpy, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc14.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc14, DialogModes.NO );
}
saveEXR()
Then it works just fine, the problem is passing a dynamic path/name through the save function. So if I swap a couple lines, for instance:
Code: Select allfunction saveEXR(archiveFile) {
var idsave = charIDToTypeID( "save" );
var desc14 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc14.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc14.putPath( idIn, archiveFile);
var idDocI = charIDToTypeID( "DocI" );
desc14.putInteger( idDocI, 84 );
var idCpy = charIDToTypeID( "Cpy " );
desc14.putBoolean( idCpy, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc14.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc14, DialogModes.YES );
}
saveEXR(archiveFile)
Then it doesn't work. Also, it will error saying it was unable to write the file. I checked, and it IS in fact passing the file into the correct directory and naming it properly, but it's not including the alpha channel at all. Soooooooo if anyone has any sort of clue what may be happening here, or if this sounds like a bug... I'd appreciate it. I'm stuck.
cs6 Exr saving issue.
-
pattesdours
cs6 Exr saving issue.
I get two seemingly similar steps when saving to EXR (32bits) with ScriptingListener active. The first appears to be an error-check of some kind, and the second one a confirmation. Maybe you just need both parts to be present?
Code: Select allvar EXRfile = new File("~/Desktop/EXR/testfile.exr");
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc11 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc11.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc11.putPath( idIn, EXRfile );
var idDocI = charIDToTypeID( "DocI" );
desc11.putInteger( idDocI, 35 );
var idLwCs = charIDToTypeID( "LwCs" );
desc11.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveBegin = stringIDToTypeID( "saveBegin" );
desc11.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
executeAction( idsave, desc11, DialogModes.NO );
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc12 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc12.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc12.putPath( idIn, EXRfile );
var idDocI = charIDToTypeID( "DocI" );
desc12.putInteger( idDocI, 35 );
var idLwCs = charIDToTypeID( "LwCs" );
desc12.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc12.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc12, DialogModes.NO );
I found an equivalent function here:
http://forums.adobe.com/message/4930238
Code: Select all// function to manually save an EXR file. Requires EXR plugn to be installed
function saveEXR(saveFile){
var idsave = charIDToTypeID( "save" );
var desc6 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc6.putString( idAs, "OpenEXR" );
var idIn = charIDToTypeID( "In " );
desc6.putPath( idIn, saveFile );
executeAction( idsave, desc6, DialogModes.NO );
}
It should be noted that alpha/transparency/compression settings (apparently) cannot be specified through scripting. The settings last used when manually saving an EXR are automatically applied.
Code: Select allvar EXRfile = new File("~/Desktop/EXR/testfile.exr");
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc11 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc11.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc11.putPath( idIn, EXRfile );
var idDocI = charIDToTypeID( "DocI" );
desc11.putInteger( idDocI, 35 );
var idLwCs = charIDToTypeID( "LwCs" );
desc11.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveBegin = stringIDToTypeID( "saveBegin" );
desc11.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );
executeAction( idsave, desc11, DialogModes.NO );
// =======================================================
var idsave = charIDToTypeID( "save" );
var desc12 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc12.putString( idAs, """OpenEXR""" );
var idIn = charIDToTypeID( "In " );
desc12.putPath( idIn, EXRfile );
var idDocI = charIDToTypeID( "DocI" );
desc12.putInteger( idDocI, 35 );
var idLwCs = charIDToTypeID( "LwCs" );
desc12.putBoolean( idLwCs, true );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc12.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc12, DialogModes.NO );
I found an equivalent function here:
http://forums.adobe.com/message/4930238
Code: Select all// function to manually save an EXR file. Requires EXR plugn to be installed
function saveEXR(saveFile){
var idsave = charIDToTypeID( "save" );
var desc6 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
desc6.putString( idAs, "OpenEXR" );
var idIn = charIDToTypeID( "In " );
desc6.putPath( idIn, saveFile );
executeAction( idsave, desc6, DialogModes.NO );
}
It should be noted that alpha/transparency/compression settings (apparently) cannot be specified through scripting. The settings last used when manually saving an EXR are automatically applied.
-
zachm
cs6 Exr saving issue.
Hmm, I'll take a look. As far as the transparency/alpha thing, that sucks if you can't script that out. I mean, Primarily I'd rather it saves as an alpha channel rather than transparency, But I'll check this out. I do have a workaround actually now for saving the files, but now other stuff is breaking, but only on PC. On OSX, the script still works as is just fine.
-
zachm
cs6 Exr saving issue.
Ok, so I ended up finding a workaround, using the latest version of proEXR-EZ, it does allow you to specify whether you save based on alpha channel, transparency, or none. That's great and it works, but now my script is broken for some reason, but again... ONLY in CS6 on PC... on a mac it works fine, on CC version of PC and Mac it works absolutely perfect.. but I've tried this on a few machines now and it errors out for some reason on this line...
Code: Select all
for (c = 0; c < ColorCount; ++c) {
activeDocument.activeLayer = activeDocument.layers.getByName(win.g3.pnl1.lb2.selection[c]);
The ExtendScript toolkit Gives me the archaic, "General Photoshop error occurred..." business. I haven't changed anything in my code other than the EXR saving function, and I don't see that messing with anything else.... Gah why!?!
EDIT*
I just came across this thread:
bb/viewtopic.php?f=5&t=4896
Must have been resolved in CC version for PC. So I'll look into it and see if there's a good workaround for the cs6 code. This site is a life saver.
Code: Select all
for (c = 0; c < ColorCount; ++c) {
activeDocument.activeLayer = activeDocument.layers.getByName(win.g3.pnl1.lb2.selection[c]);
The ExtendScript toolkit Gives me the archaic, "General Photoshop error occurred..." business. I haven't changed anything in my code other than the EXR saving function, and I don't see that messing with anything else.... Gah why!?!
EDIT*
I just came across this thread:
bb/viewtopic.php?f=5&t=4896
Must have been resolved in CC version for PC. So I'll look into it and see if there's a good workaround for the cs6 code. This site is a life saver.