1
votes

I've tried many ways to unlock a partially locked layer in Photoshop using Javascript but nothing works. Here's a few examples of what I've tried:

var layerRef = app.activeDocument.artLayers.getByName('Background');
layerRef.allLocked = false;

The below alert returns false:

alert(app.activeDocument.layers[0].allLocked);

So it's not locked? I just want to convert this partially locked layer to a not locked layer.

My documentation source:

https://www.adobe.com/content/dam/acom/en/devnet/photoshop/pdfs/photoshop-cc-javascript-ref-2019.pdf

partially locked layer

1

1 Answers

3
votes

Background is kind of a particular weird layer type in Photoshop. To unlock it (and convert to a normal layer) you need to use this specific command:

activeDocument.activeLayer.isBackgroundLayer = false;

Using the same property you can check if a layer is a Background layer and you can set any layer as a BG layer.