Access to all layers in the Illustrator

There seem to be more than two layers
The Illustrator Scripting Object Model

Solution

var counter = 0; // I know it's not good to use a global variablecountingLayers(activeDocument.layers);
alert('True layers length: ' + counter);
function countingLayers(_layers) {
for (var i = 0; i < _layers.length; i++) {
var iLayer = _layers[i];
if (iLayer.layers.length > 0) {
countingLayers(iLayer.layers);
}
counter++;
}
}

In use

Rename all layers and sublayers

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store