Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script apply variable value to expression

Tagged: 

  • Script apply variable value to expression

    Posted by Kevin Snyder on April 20, 2022 at 10:29 pm
    I have a script that applies an expression to a selected property. When I apply the expression, I would like the layer name to reference a variable. In my example, I would like the value of var myCustom to be used for thisComp.layer in the expression. Is it possible?

    var myCustom = “Drive” + ” ” + “//” + ” ” + myControl;// Custom Layer Name

    var myExpr = ‘temp = thisComp.layer(myCustom).effect(“Drive”)(“Output 01”); dim = value instanceof Array ? value.length : 1; dim > 1 ? [temp,temp] : temp’;

    Kevin Snyder replied 1 year, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 20, 2022 at 11:53 pm

    You want the script to build the current value of script variable myCustom into the expression, is that correct? I think that would be like this:

    var myExpr = 'temp = thisComp.layer("' + myCustom + '").effect("Drive")("Output 01"); dim = value instanceof Array ? value.length : 1; dim > 1 ? [temp,temp] : temp';
  • Kevin Snyder

    April 25, 2022 at 5:15 am

    Great! Thank you. That’s what I was looking for. I appreciate it!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy