Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Can’t get Source Text parameter to execute 2 expressions.

  • Can’t get Source Text parameter to execute 2 expressions.

    Posted by Daniel Annefelt on October 5, 2020 at 7:37 pm

    Hello genius people!

    Running AE 17.1.4 with JavaScript enabled,

    I have two simple expressions on the Source Text parameter.

    The first expression retrieves text input from another layer in a separate Comp.

    ______

    comp(“CHANGE TEXT”).layer(“1 Line Small Text”).text.sourceText

    ______

    The second expression changes between two fonts of the text based on a Expressions Checkbox effect.

    ______

    if (comp(“CHANGE TEXT”).layer(“Layout_Selector”).effect(“Comedy Central”)(“Checkbox”) == 1)

    (text.sourceText.style.setFont(“AmericanTypewriter”))

    else

    (text.sourceText.style.setFont(“Helvetica”))

    ______

    Each expression works like a charm when using one or the other.

    But when combined – with is my goal – it stops retrieving the text from the other layer.

    ______

    comp(“CHANGE TEXT”).layer(“1 Line Small Text”).text.sourceText

    if (comp(“CHANGE TEXT”).layer(“Layout_Selector”).effect(“Comedy Central”)(“Checkbox”) == 1)

    (text.sourceText.style.setFont(“AmericanTypewriter”))

    else

    (text.sourceText.style.setFont(“Helvetica”))

    ______

    Obviously there is some syntax missing that tells the Source Text to do two things

    – get text from another layer and check what font to use based on the checkbox.

    But my merger expressions skills can’t crack this.

    Does anyone have a solution to this or is a current AE cc2020 limitation

    cheers!

    .::D

    Daniel Annefelt replied 5 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Stephen Dixon

    October 6, 2020 at 2:15 am

    You need to store the sourceText in a variable, and apply the style changes to that variable. So:

    let st = comp(“CHANGE TEXT”).layer(“1 Line Small Text”).text.sourceText;
    if (comp(“CHANGE TEXT”).layer(“Layout_Selector”).effect(“Comedy Central”(“Checkbox”) == 1){
    st.style.setFont(“AmericanTypewriter”)
    } else {
    st.style.setFont(“Helvetica”)
    }
    st
  • Daniel Annefelt

    October 6, 2020 at 9:05 am

    Thanx!

    .::D

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