JS batch method to change the layer name in PS

  • 2020-03-30 01:27:33
  • OfStack

 
#target photoshopapp.bringToFront(); 
if (documents.length == 0) { 
alert(" There is no documentation to process "); 
} else { 
var visibility = false; 
var docRef = activeDocument; 
var layers = docRef.layers; 
if (layers.length == 1 && docRef.activeLayer.isBackgroundLayer == 1) { 
alert("The Background layer can not be hidden when it is the only layer in a document."); 
} else { 
for (var i = 0; i < layers.length; i++) { 
var tempName = "name" + i;//The modified name
layers[i].name = tempName; 
} 
} 

} 

Save the above code as a. JSX file and run it as a script in ps.

Only all layer modes are supported, not groups

Related articles: