Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Order Layers Alphabetically in Photoshop
var layers = activeDocument.layers;
var layersArray = [];
var len = layers.length;
// store all layers in an array
for (var i = 0; i < len; i++) {
// sort layer top to bottom
for (i = 0; i < len; i++) {
layersArray[i].move(layers[i], ElementPlacement.PLACEBEFORE);
Copy link

dsharpminor commented Nov 6, 2020

Thank you for sharing this piece of code. I was wondering how natural sort could be implemented? Right now the output looks like this:
1a, 10a, 2b. And I was wondering what could be done to make it 1a, 2b, 10a?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment