Reply To: Layer Naming & Add Layer with box script wish

#14323191

I’m very new to scripting and have spent half the day teaching myself and trying to find the parts to build a simple script.
This is the closest I’ve found to a solution, but it’s not quite what I need.

I’m attempting to write a script that will change the color of my InDesign layers based on the layer name. “Art” = Red, etc.
This and similar scripts makes it very easy to do this with new layers.

I’ve also found a script that will search for particular layers, and if they do not exist in the document, will add them, and set them to a particular color. If the specified layers already exist in the document, it will ignore it and go on to the next layer.

So I need to find an existing layer and change its color. Seems like it should be easy. Is it?

What I’ve been trying to do is take this line:

app.documents[0].layers.add ({name: ‘die line’, layerColor: UIColors.RED}).move(LocationOptions.AT_BEGINNING);

and use the relevant bits of code on an existing layer. Can I replace the “.add” with something else to achieve this?

This article was last modified on January 27, 2020

Comments (0)

Loading comments...