Last active
January 3, 2025 21:03
-
-
Save hilukasz/1d7da185b8af863fa88d to your computer and use it in GitHub Desktop.
unlockAllLayers_Photoshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save as unlockAllLayers_Photoshop.jsx and put it in your scripts folder to see it in File > Scripts | |
var topLayer = app.activeDocument.layers[0]; | |
app.activeDocument.activeLayer = topLayer; | |
do{ | |
unlockLayer(); | |
selectLayerBelow(); | |
}while(topLayer != app.activeDocument.activeLayer) | |
function unlockLayer(){ | |
if(app.activeDocument.activeLayer.isBackgroundLayer ) app.activeDocument.activeLayer.name = 'From Background'; | |
if(app.activeDocument.activeLayer.allLocked) app.activeDocument.activeLayer.allLocked = false; | |
if(app.activeDocument.activeLayer.pixelsLocked) app.activeDocument.activeLayer.pixelsLocked = false; | |
if(app.activeDocument.activeLayer.positionLocked) app.activeDocument.activeLayer.positionLocked = false; | |
if(app.activeDocument.activeLayer.transparentPixelsLocked) app.activeDocument.activeLayer.transparentPixelsLocked = false; | |
}; | |
function selectLayerBelow(){ | |
var desc = new ActionDescriptor(); | |
var ref = new ActionReference(); | |
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Bckw" ) ); | |
desc.putReference( charIDToTypeID( "null" ), ref ); | |
desc.putBoolean( charIDToTypeID( "MkVs" ), false ); | |
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment