• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

775

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

People's Champ , 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"),

...

Votes

Translate

Translate
Adobe
Community Expert ,
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.

Votes

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
People's Champ ,
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"));

Votes

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

Votes

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

Votes

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