Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Text string problems

  • Text string problems

  • Nick Kennedy

    July 8, 2022 at 11:12 am

    Hi Filip, many thanks for your help! This did the trick but now I have run into a new problem! Please could you take a look. The first screenshot everything is working as it should, i put the space after the %-sign and it worked. But then I changed the price in the csv File to a negative value and this wasn’t colored red. Will the exression selector only find one text to highlight and not look any further? I want to eventually put several stock prices and the % change from previous day in one text layer. Is it possible that the expression selector can find all incedences of negative and positive values and color them red and green respectively? I greatly appreciate you guys taking the time to help, Thanks!

  • Filip Vandueren

    July 8, 2022 at 12:00 pm

    Hi Nick, you’re correct the setup now only seems to catch 1 positive and 1 negative term.

    I would approach it a bit differently:

    • remove the separate red and green animators (but keep the expressions of the sourceText)
    • make the text Black in the Character palette
    • add a textanimator that colors the RGB Fill of the letters White.
    • give this text animator an expressions selector, make sure to set it “based on words”
    • here’s the expression, by “partially” selecting the amount the black letters become white, we can actually color it in. The resulting value of an expression selector can actually have up to three dimensions, and in this case that corresponds to RGB.
    words=text.sourceText.trim().split(/\s+/);
    i=textIndex-1;
    if (words[i].match(/-[0-9\.]+%/)!==null) {
    [100,0,0]; // red
    } else if (words[i].match(/\+[0-9\.]+%/)!==null) {
    [0,100,0]; // green
    } else {
    [100,100,100]; // white
    }

    This way you can set up even more regexp matches, for example:

    … } else if (words[i].match(/[0-9\.,]+€/)!==null) { 
    [80,70,0]; // yellow
    } else { …

  • Nick Kennedy

    July 8, 2022 at 12:18 pm

    Hi Filip, yes!!! this appears to work just right! Many Many Thanks for your help.

  • Nick Kennedy

    August 3, 2022 at 2:07 pm

    I just wanted to thank again Filip and Andrei for helping me out on this project. Creative cow is such a great place to get help, I hope one day to be knowledgeable enough to help people out on these forums as well, but until then, I’ve attached a copy of the final project in case anyone would like to take a look at this. I actually wanted to create a MOGRT for premiere pro, so that the editors could simply swap out the CSV file but unfortunately it doesn’t seem to work well. I may well open another Forum Thread over on the Premiere Pro Forum. In the meantime we are using direct link to the AE Comp and simply saving the new CSV file over the old one. Anyone who sees this and has experience working with CSV files in MOGRTS, any tips would be appreciated. Thanks again Creative Cows everywhere!

Viewing 11 - 14 of 14 posts

Log in to reply.

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