Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Getting Source Text from multiple layers

  • Getting Source Text from multiple layers

    Posted by Michael Sutton-long on September 28, 2010 at 11:04 pm

    Hello! I’m very new to this, so apologies if this question seems very basic.

    I’m trying to get text from two different layers in a master comp to combine into one line of text in subsidiary comps.

    Is this possible!? It seems like it should be but I’m doing something wrong as the expression below doesn’t work!

    Hope you can help.

    comp("typehere").layer("WEDNESDAY OCTOBER 20").text.sourceText+.layer("NEXT 11PM/10c").text.sourceText

    Dan Ebberts replied 15 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 28, 2010 at 11:23 pm

    I think you just forgot the comp name for the second layer. I like this more compact notation:

    L1 = comp(“typehere”).layer(“NEXT 11PM/10c”);
    L2 = comp(“typehere”).layer(“WEDNESDAY OCTOBER 20”);
    L1.text.sourceText + L2.text.sourceText;

    If you want each text on a separate line, it would be like this:

    L1 = comp(“typehere”).layer(“NEXT 11PM/10c”);
    L2 = comp(“typehere”).layer(“WEDNESDAY OCTOBER 20”);
    L1.text.sourceText + “\r” + L2.text.sourceText;

    Just a caution though, if you’re going to be changing the text in the main comp, I’d give the text layers actual names like Date and Time so that changing the text doesn’t break the expressions.

    Dan

  • Michael Sutton-long

    September 28, 2010 at 11:39 pm

    Works perfectly, thank-you so much. Even got it working with four input laters! Thanks again, Michael

  • Brian Yarnell

    September 29, 2010 at 9:47 pm

    This is super cool. I notice that this always cneters the text when stacked. Is there a way to have the text aligned left or right?
    Thanks

  • Dan Ebberts

    September 29, 2010 at 9:49 pm

    Select the text layer and choose the alignment you want in the paragraph palette.

    Dan

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