Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Does anybody know how to isolate the name — not the value — of a given variable?

  • Does anybody know how to isolate the name — not the value — of a given variable?

    Posted by Teague Chrystie on May 2, 2018 at 10:46 pm

    Hey folks, hope all is well. I’m trying to write a function in a sourceText expression which would basically look like this:

    function exampleFunction(exampleInput){

    string = exampleInput.name + "~" + exampleInput.value;
    return string

    }
    Thus, if I had a variable named creativeCow with a value of 99, calling exampleFunction(creativeCow) would return “creativeCow~99” as that layer’s text output.

    This is one of those things where I just typed it out assuming the syntax would be there, and it took me a minute to realize that apparently… it’s… just not possible?

    Am I nuts?

    Thanks.

    Andrei Popa replied 8 years ago 2 Members · 1 Reply
  • 1 Reply
  • Andrei Popa

    May 3, 2018 at 1:35 pm

    I don’t think you can call a variable name in javascript. If, however, you put an object in there, like opacity, it works just fine. I think you need an object that has the .name and the .value properties. It also does not work if your value is an array, since javascript doesn’t convert the array into string before concatenating.

    Andrei
    My Envato portfolio.

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