Skip to main content
Inspiring
October 13, 2020
Answered

How do I use an array in a variable?

  • October 13, 2020
  • 1 reply
  • 408 views

I have a script which looks for a layer named "Car" and gets its position value. However, I also need it to look for other names and case variations, just in case "Car" doesn't exist. eg - "CAR" "Truck" "TRUCK", etc

 

The line in question is this…

 

var pos = app.project.activeItem.layer("Car").transform.position.value;

 

 

What's the correct syntax for changing that line into an array that would look for all possible variations above?

I tried this, but it's obviously wrong because it doesn't work…

 

var pos = app.project.activeItem.layer(["Car","CAR","Truck","TRUCK"]).transform.position.value;

 

 

This topic has been closed for replies.
Correct answer Mark Paterson

For future reference, a solution was found here… https://www.reddit.com/r/AfterEffects/comments/jagadz/how_do_i_use_an_array_in_a_variable/

1 reply

Mark PatersonAuthorCorrect answer
Inspiring
October 14, 2020