Copy link to clipboard
Copied
Hi guys, I've been trying to come up with a script that unlocks all layers, groups and nested layers in a PSD file, but unsuccessfully.
I think it should be simple, but I can't make it work. And I need to achieve this by script, so later I can do some more tweaking.
example of layers:
Any help??
thanks so much!!!
D
...app.runMenuItem(stringIDToTypeID("selectAllLayers"));
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("protectNone"), true);
d1.putObject(stringIDToTypeID("layerLocking"), stringIDToTypeID("layerLocking"), d2);
d.putObject(stringIDToTypeID("to"),
Copy link to clipboard
Copied
Use scriptListener to get the code to unlock the layers. Then you need to create a recursive function to cycle through all the layers and layersets.
Copy link to clipboard
Copied
app.runMenuItem(stringIDToTypeID("selectAllLayers"));
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("protectNone"), true);
d1.putObject(stringIDToTypeID("layerLocking"), stringIDToTypeID("layerLocking"), d2);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("layer"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
app.runMenuItem(stringIDToTypeID("selectNoLayers"));
Copy link to clipboard
Copied
My god, you're a genius!
that worked flawlessly!
By looking at your code, it was definitely out of my league, I need to learn and practice more
Thanks so much!!!
Copy link to clipboard
Copied
Need one AfterEffect layers unlocking
Find more inspiration, events, and resources on the new Adobe Community
Explore Now