Unlocked all layers and nested layers

Community Beginner ,
May 23, 2019 May 23, 2019

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

TOPICS
Actions and scripting

Views

413

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 23, 2019 May 23, 2019

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"),

...

Likes

Translate

Translate
Adobe Community Professional ,
May 23, 2019 May 23, 2019

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 23, 2019 May 23, 2019

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"));

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 24, 2019 May 24, 2019

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!!!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

LATEST

Need one AfterEffect layers unlocking

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines