I used the script to the selected layers. If the layer is in a group of layers, an error occurs when you call the function:
doc.activeLayer = app.activeDocument.artLayers.getByName(nameLayer);
error- No such element.
How to choose the layer is in a group of layers or out of group? Thanks