Created
December 1, 2016 12:50
-
-
Save wdhwg001/17435f4bef02d0e73769cf79054beb21 to your computer and use it in GitHub Desktop.
Photoshop script: getSelectedLayersIndex
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 getSelectedLayersIndex = function () { | |
var selectedLayers = []; | |
var ref = new ActionReference(); | |
ref.putEnumerated(stringIDToTypeID('document'), stringIDToTypeID('ordinal'), stringIDToTypeID('targetEnum')); | |
var desc = executeActionGet(ref); | |
if (desc.hasKey(stringIDToTypeID('targetLayers'))) { | |
desc = desc.getList(stringIDToTypeID('targetLayers')); | |
for (var i = 0, c = desc.count; i < c; i++) { | |
selectedLayers.push(desc.getReference(i).getIndex()); | |
} | |
} | |
return selectedLayers; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment