FORUMS: list search recent posts

Linking source text to separate lines.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
riccardo sinti
Linking source text to separate lines.
on Sep 1, 2011 at 8:54:59 pm

I have about 40 comps each with it's own title as a text layer.
I want to simplify changing the titles by making it unnecessary to open each comp and manually changing the text layer for each title.
So far i have created a "Titles" comp with 40 text layers and I pick-whiped the source text of each of the 40 comps title text layers to it's corresponding source text in the "Titles" comp. This way if I need to change titles I can just open the "Titles" comp and then manually change each of the 40 text layers and then the tiles will change for the 40 comps. Great.
But it just occurred to me that maybe I could have just one layer in the "titles" where I could just type all at once or copy and paste all the titles in 40 lines and have the source text expression extract the titles from it's corresponding line.

All that to ask- can a source text expression get info out of specific line of a single text layer?


Return to posts index

Dan Ebberts
Re: Linking source text to separate lines.
on Sep 1, 2011 at 9:05:02 pm

This should give you the third line of text layer "text" in comp "other comp":

txt = comp("other comp").layer("text").text.sourceText;
txt.split("r")[2]

Note: there should be a backslash character before the r in the second line, but I can't get those to show up reliably, so you may have to add it yourself.

Dan



Return to posts index

riccardo sinti
Re: Linking source text to separate lines.
on Sep 1, 2011 at 9:17:10 pm

I am amazed at the speed in which I get responses at on The Cow!
Unfortunately I get the warning that " Class 'Array' has no property or method named '2' "
Can you elucidate as to what split, "r" and [2] means in this expression?
you wrote that this would return the third line of text. i gather that means that the first line would be [0] as in an array?
Thanks!

Thank You


Return to posts index


Dan Ebberts
Re: Linking source text to separate lines.
on Sep 1, 2011 at 9:24:13 pm

split(_backslash_r) splits your text at carriage returns into an array. So if this is your text:

line 1
line 2
line 3
line 4

The expression should return "line 3". You did put the backslash in, right?

Dan



Return to posts index

riccardo sinti
Re: Linking source text to separate lines.
on Sep 1, 2011 at 9:31:17 pm

I didn't see any backslash is your original reply: txt.split("r")[2]
not sure where to put in the backslash

Thank You


Return to posts index

riccardo sinti
Re: Linking source text to separate lines.
on Sep 1, 2011 at 9:34:31 pm

Got it thanks!

Thank You


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]