Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Can Javascript string’s auto-update?

  • Can Javascript string’s auto-update?

    Posted by Roland R. kahlenberg on March 10, 2014 at 10:20 am

    I’ve got the following script that works fine BUT when the Expression Control’s name is manually changed, the script does not auto-update.

    Math.abs(thisComp.layer(“Controller”).effect(“Value Bar” + ” ” + exactString)(“Slider”));

    Is there a way to allow the script to auto-update OR have the script written it in such a manner that the part before exactString is ignored, to the extent that that part of the name can be changed without resulting in an error in the script?

    Essentially, I’m looking at using a wildcard – sorta like the asterisk for a wildcard search in Windows .

    TIA
    RoRK
    Latest AE Workshop – MoGraph Intensity – Shapes & Text

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

    Roland R. kahlenberg replied 12 years, 6 months ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    March 10, 2014 at 2:46 pm

    I’m confused. Where does exactString get defined?

    Dan

  • Roland R. kahlenberg

    March 10, 2014 at 2:55 pm

    Hi Dan

    Does the following help you get a bigger/better picture?
    stringerLength = thisLayer.name.length;
    stringerName = thisLayer.name;
    exactString = stringerName.substring(stringerLength-2,stringerLength);

    CredValue = Math.abs(thisComp.layer("Controller").effect("Credit Value" + " " + exactString)("Slider"));

    RoRK
    Latest AE Workshop – MoGraph Intensity – Shapes & Text

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Dan Ebberts

    March 10, 2014 at 3:24 pm

    I can’t reproduce the problem. When I change the last two characters of the layer name, the expression gets the new value from the correct slider.

    Dan

  • Roland R. kahlenberg

    March 10, 2014 at 3:30 pm

    Layername does work.

    It’s the variable “CredValue” that gets the error when I change the name of the referenced Expressions Control (effect).

    HTH
    RoRK
    Latest AE Workshop – MoGraph Intensity – Shapes & Text

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Dan Ebberts

    March 10, 2014 at 3:53 pm

    I guess I still don’t get it. The expression is looking for a slider named “Credit Value ” plus the last two characters of its layer’s own name, correct? Are you saying you want to be able to change the name of the slider without breaking the expression? I don’t see how that can work, because the name that the expression calculates for the slider doesn’t change.

    Dan

  • Roland R. kahlenberg

    March 10, 2014 at 3:59 pm

    I thought so too Dan. Looks like I’ll have to do a simple Expression link instead of the string method.

    Cheers
    RoRK
    Latest AE Workshop – MoGraph Intensity – Shapes & Text

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

  • Dan Ebberts

    March 10, 2014 at 4:09 pm

    You can get the name of the slider like this (and it will update when you change the name):

    sliderName = thisComp.layer(“Controller”).effect(“Credit Value 01”)(“Slider”).propertyGroup(1).name;

    I don’t know if that helps or not.

    Dan

  • Roland R. kahlenberg

    March 10, 2014 at 4:55 pm

    IT Works!

    Thanks Dan!

    Cheers
    RoRK
    Latest AE Workshop – MoGraph Intensity – Shapes & Text

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

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