-
having a script find a substring in a layer name
I have a script that creates several layers in the comp when run – and now I’m trying to build a “remover” script that allows for convenient one click removal of those layers when desired.
When the first script creates the layers it names them something descriptive indicating what the layer does (that part is the same every time the “creator” script runs) and then it appends current date and time to the name to make them unique within the project. So (assuming the layer names haven’t been edited in the meantime) my “remover” script can know what the descriptive part of the name is (but not the other date/time part of the layer name) So I have my “remover” script looping through the comp layers trying to identify these layers by part of the name.
I find that
layerName==”nova”
works fine to find a layer that is precisely named “nova” but when I try layerName.includes(“nova”) or layerName.startsWith(“nova”) I’m getting undefined errors…what’s a good way to do this in an AE script ? Thanks for any suggestions.