-
layer name based on layer comment
Hi guys!
I have one comp with 8 text layers with the following layer.name and layer.comment:
name: a comment: 2
name: b comment: 1
name: c comment: 4
name: d comment: 3
name: e comment: 6
name: f comment: 5
name: g comment: 8
name: h comment: 7
(comments are in this random order)And in my script I have an Array with only four numbers (in numerical order): [1,2,3,4]
I want to go through all my layers and if the layer comment matches an objects inside my array to change the layer name to that value. I was trying to accomplish this with a for loop, but my problem is that the way I am doing it, unless the array and the layer comment are in the same order as it goes through the for loop it does not match one with the other… Also, does it matters that the numLayers is bigger than my array.length? Anyhow, Does anyone knows how to do this?
This is what I was trying… but not working yet…
for(var i=1; i <= comp.numLayers; i++){
layerComment[layerComment.length] = comp.layer(i).comment;
for(var m=0; m < ID_text.length; m++){
if(ID_text[m] == layerComment){
comp.layer(i).name = layerComment;
}}
}Thanks!!!
Fabio