Created
January 17, 2012 21:04
-
-
Save vladocar/1628853 to your computer and use it in GitHub Desktop.
Layer Duplicates in 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
var layerNum = app.activeDocument.layers.length; | |
var arr = []; | |
for (var i = 0; i < layerNum; i++) { | |
arr[i] = '"'+app.activeDocument.layers[i].name+'"'; | |
} | |
// taken from: http://stackoverflow.com/questions/840781/easiest-way-to-find-duplicate-values-in-a-javascript-array | |
var sorted_arr = arr.sort(); // You can define the comparing function here. | |
// JS by default uses a crappy string compare. | |
var results = []; | |
for (var i = 0; i < arr.length - 1; i++) { | |
if (sorted_arr[i + 1] == sorted_arr[i]) { | |
results.push(sorted_arr[i]); | |
} | |
} | |
prompt("Layers Names:", results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment