- Editado
Small bug in photoshop script
How to reproduce:
Photoshop CS4 extended
Load script and run (default settings)
The problem is in the rasterizeAll action that the script is trying to execute. Appearantly it is not supported in that CS version.
I worked around it by uncommenting the rasterizeAll calls, like so:
function rasterizeAll () {
try {
// executeAction(sID("rasterizeAll"), undefined, DialogModes.NO);
} catch (ignored) {}
}
function rasterizeStyles (layer) {
activeDocument.activeLayer = layer;
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(cID("Lyr "), cID("Ordn"), cID("Trgt"));
desc.putReference(cID("null"), ref);
desc.putEnumerated(cID("What"), sID("rasterizeItem"), sID("layerStyle"));
// executeAction(sID("rasterizeLayer"), desc, DialogModes.NO);
}
Thanks for reporting. Do both of the lines you commented cause problems for CS4? The rasterizeAll
function uses a try/catch, so it should be OK if it fails (but I wouldn't be surprised if Photoshop still fails). Maybe surrounding the executeAction
in rasterizeStyles
would be sufficient?
Hi Nate,
Thanks for the quick reply. I tried your suggestion and yes, moving the executeAction into a try catch block works when running in photoshop.
I think because I was debugging it, the flow was halted on both occurences although one was actually being catched later on. First time I tried debugging a photoshop script - I prefer real programming languages but this went pretty smoothly :-)
Now, onto getting some stuff going in Spine!
Grtz,
Niels
Oh, great we'll wrap the second one in a try/catch and hopefully it'll save others the trouble. Thanks for taking the time to share!
It seems the latest script already had the try/catch! You can get the latest here:
http://esotericsoftware.com/spine-scripts/PhotoshopToSpine.jsx
Or from the spine-scripts repository:
spine-scripts/photoshop at master · EsotericSoftware/spine-scripts