Copy link to clipboard
Copied
Hey everyone, I'm trying to update a portion of my .jsx 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 as many of you know.
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):
function 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:
function 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.
Copy link to clipboard
Copied
Hi Zach,
Does the same thing happen with other formats? Also, was the script listener code generated with the older CS5 OpenEXR plug-in or the CS6 OpenEXR plug-in?
regards,
steve
Copy link to clipboard
Copied
Hey Steve, sorry for the late response, been way too busy to even look into the issue here... Yeah it happens with other formats. And I tested the script listener code for both. Digging deeper in, There's more things that broke here with the update to cs6, some loops that check the number of layersets error out as well as some other random things... The crazy thing is that the exact same script works absolutely fine with CS6 on OSX...
And @Paul, Yeah, I tried that and still no love.
Copy link to clipboard
Copied
Ok, so now I'm actually very confused, and I hope someone can possibly shed some light on this. Very confused, and don't really want to waste time if this is a bug maybe in the software.. But I tested the script on the following platforms/versions using the exact same script, but using different .exr plugins for each one. Here's the results I got:
PcX64 CS5 openEXR_Alpha.8bi works
OSX CS5 openEXR_Alpha.8bi (mac) works
PcX64 CS6 openEXR_Alpha.8bi Does Not work
OSX CS6 openEXR_Alpha.8bi (mac) works
PcX64 CC openEXR_EZ.8bi works
OSX CC openEXR_EZ.8bi (mac) untested..
So I'm confused, my script all-together just breaks when I run it on any PC using CS6. I've tried six different PC's each having the same issue. It freezes on saving out a file. I hope that someone from Adobe can possibly recognize this issue maybe or something? I don't know, it's really hard for me. I wrote this code, and use it every day at work, and it's starting to get a little frustrating here because I'm completely lost at this point. ExtendScript toolkit isn't very helpful when it comes to telling me what the error is....
EDIT** Got it sorted out. Have it working now, after figuring out the alpha output with .EXR I ran into what turned out to be a bug with the list selection in my script. Apparently there's a bug in CS6 on PC where if you have your preferences set to not open documents as tabs, you error out... So I just made some functions to check if it's on or off and if it's off, turn it on and then off when it's done with the process.
As for scripting the alpha, the .EXR that comes with Photoshop will not allow you to specify whether you interpret the alpha as an alpha channel or transparency. Due to the way I process the images in the script, there is no transparency, and only an alpha channel, so using the default .EXR plugin is problematic for me at best. The http://fnordware.blogspot.com/2012/04/proexr-ez-is-free.html plugin gives me the flexibility to decide whether I want none/alphaChannel/Transparency saved out with my image, so I'm moving forward with that. Adobe could take a cue from the guy who's putting that plugin together, Most people who even use EXR with photoshop work in the same industry as him, so it's safe to assume he is providing a field tested solution.
Copy link to clipboard
Copied
The first is passing a file object the second function looks as if it only getting a string not a file object.
You could try..
saveEXR(new File(archiveFile));