Question
Scripting: detect layer names -- only first result returned
I have a composition that contains several layers.
Some of the layers are named with "##Q[number]" to mark ##Q1,##Q2,##Q3,##Q4,##Q5 & ##Q6
So when I'm trying to detect if the layers are present, I run the following script:
for (i = 1; i <= mainComposition.numLayers; i++) {
var layer = mainComposition.layer(i);
var findIntroLayer = '##Q' + i;
if (layer.name === findIntroLayer) {
$.writeln(findIntroLayer + " found!");
}
}
I only get back:
##Q1 found!
When I do this in a hard-coded way:
if (layer.name == '##Q1') {
$.writeln("##Q1 found!");
}
if (layer.name === '##Q2') {
$.writeln("##Q2 found!");
}
...
I get back all the layers I'm targeting.
Don't know why the dynamically created layer name wouldn't work ... any ideas?
