public
Created

Order Layers Alphabetically in Photoshop

  • Download Gist
layersOrder.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
var layers = activeDocument.layers;
var layersArray = [];
var len = layers.length;
 
 
// store all layers in an array
for (var i = 0; i < len; i++) {
layersArray.push(layers[i]);
}
 
// sort layer top to bottom
layersArray.sort();
 
for (i = 0; i < len; i++) {
layersArray[i].move(layers[i], ElementPlacement.PLACEBEFORE);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.