Illustrator script: How to print layers name?

Viewed 1148

I'm working with an SVG map in Illustrator. Each constituency of the map is a layer with its own name.

I would like to print the name of each layer of the map so I can identify each layer when needed.

I wrote this ai script

print(document.activeLayer.name);
var layer = new Layer();
layer.name = 'A new layer';
layer.activate();
print(document.activeLayer.name); 
print(document.layers.length);

but an "Error 24: print is not a funciton. Line 1". I can't understand how to fix the error. Has anyone idea of how to make this script work?

Thanks, Daniele

2 Answers
Related