How do I duplicate multiple PS layers (lots of them!) so that each layer is below its copy
how to duplicate multiple Photoshop layers (hundreds of them!) so that each layer is below its copy, i.e. rather than all the copies being in one group and the original in the other (as normal)? Hope this posted in correct forum. Would be grateful of any advice.
E.g. from this:
layer4
layer3
layer2
layer1
Duplicated to this:
layer4 copy
layer4
layer3 copy
layer3
layer2 copy
layer2
layer1 copy
layer1
Rather than this:
layer4 copy
layer3 copy
layer2 copy
layer1 copy
layer4
layer3
layer2
layer1
Public Question, everyone could view answers and download attachments.
Finish this task then you can earn
10
>>Back to Task List
2205 views 1 answers
0
Not sure what version of PS you are using, but here is a simple script I lifted from the Photoshop CC Javascript guide ("ArtLayer.jsx" page 62-4) and it seems to work here on CC (if you want to change the sort order, change "ElementPlacement.PLACEAFTER" to "ElementPlacement.PLACEBEFORE"):
// sort the layers by name
for (var x = 0; x < app.activeDocument.layers.length; x++) {
for (var y = 0; y < app.activeDocument.layers.length - 1 - x; y++) {
// Compare in a non-case sensitive way
var doc1 = app.activeDocument.layers[y].name
var doc2 = app.activeDocument.layers[y + 1].name
if (doc1.toUpperCase() > doc2.toUpperCase()) {
app.activeDocument.layers[y].move(app.activeDocument.layers[y+1], ElementPlacement.PLACEAFTER)
}
}
}
If you are going to use this often, I suggest saving it in a plain text editor as sort.jsx or something similar (the .jsx extension is necessary for PS for most current versions) in the startup scripts folder for photoshop so it loads everytime and you can attach a hotkey, too.
Lemme know how it works.
Save early. Save often.
2014-07-14 0 Comments