Copy link to clipboard
Copied
Hi all,
I have been looking into the scripting side of Illustrator and have been struggling to get my head around things.
I am trying to create a simple code that would find a layer by name/ID and change its content.
I can create a code to create a new layer, but I am struggling to modify this to allow me to change a layer that already exists.
Any help is greatly appreciated.
Copy link to clipboard
Copied
A layer named "Layer 1" is referenced as such
app.activeDocument.layers["Layer 1"]
For example, to lock layer "Layer 1"
app.activeDocument.layers["Layer 1"].locked = true;
Or, to remove all path items from layer "Layer 1"
app.activeDocument.layers["Layer 1"].pathItems.removeAll();
Copy link to clipboard
Copied
Thanks so much for your quick response - will give this a go.
Thanks again