Checking for layer name

I’m trying to figure out how to have an automation check to see if a layer exists and, if it doesn’t, to make one with that name. I can’t wrap my brain around how I might be able to do that. Is it possible?

You can do that by creating a Boolean variable and setting it to “false”.
Then loop on all the layers and if it encounters a layer with the name that you specified, set it to “true”.
After that, create an “if” line that asks if the variable is still false - if it is, that means that a layer with that name doesn’t exist.

Here is an example of an automation that looks for a layer named “Blah Blah”, and if it doesn’t exist, it creates a solid with that name (the green lines are the important ones):

1 Like

Ah, yes! I always forget about Booleans. Thank you!!!

@skimber you can actually use also Number/Text variable instead of Boolean if you want,

  • you can set the number to 0 and if you find the layer set it to 1(and then check if the number is 0).
  • or set the text variable to “doesn’t exist” at first and change it to “exists” if you find the layer. (and check if this variable equal to “doesn’t exist” and create the layer)

but Boolean is the most convenient option.

1 Like