ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Detecting specific character in a text layer

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Yan Trudel
Detecting specific character in a text layer
on Nov 2, 2011 at 2:01:57 pm

Hi everyone,

I've been roaming around creative cow for a while, always finding answers to my questions withour ever posting a question... But not this time!

I'm building a ToolKit for a TV Station. I'm working on a billboard where they just have to input the name of their shows, the times and then render the billboard.

The problem is, some shows have subtitles, some are long and require 2 lines of text and some are short ands should be on one line only. So I've created a precomp for each specific case.

I've made this little script so that when they input a "*", it substitutes with a "/r" so the title is on two lines :
txt=comp("1. TEXTE").layer("EMISSION1_TITRE").text.sourceText;
txt.replace("*","r");

In the appropriate composition's opacity, I'd like to put an expression saying "if you detect the '*', opacity should be 0%"

Since I'm not that familiar with all the expressions out there, my skills are rather basic. I've been trying to create a variable from stuff I've found on the web like :

Detect=comp("1. TEXTE").layer("EMISSION1_TITRE").text.sourceText.characterValue;

or

Detect=comp("1. TEXTE").layer("EMISSION1_TITRE").text.sourceText.indexOf("*");

But this doesn't seem to work, or I don't know how to make it work.

Any help on this would be great!
Thanks


Return to posts index

Roland R. Kahlenberg
Re: Detecting specific character in a text layer
on Nov 2, 2011 at 2:42:43 pm

What I've done previously is to provide separate precomps for single and two-line titles and also separate 'final comps' for each. This seems to work well.

As for your methodology, I'm not seeing how you're tying everything together - for example, which layer is the Opacity Expression applied to? Perhaps a description of the comp's contents as well as the structure of the comps you have will be a good starting point.

Additionally, you may want to use the Checkbox Expression Control to define if there will be a single or two-line input.

HTH
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

Yan Trudel
Re: Detecting specific character in a text layer
on Nov 2, 2011 at 4:41:29 pm

I see my post maybe wasn't clear enough. But I've been working through this and finally figured it out. I was trying to create a variable where I didn't really need one.

Here's how the project is built :
2 Main Comps : 1) called "TEXTE" where you input the text (time, title, sub-title), 2) one called "RENDER" where everything happens and where the render come from.

In the "RENDER" comp, it's a billboard saying "Tonight" and where you have three different times and where the show playing is set beside each time. For each title, I made 3 secondary precomps, one for each possibility : a one line title, a two line title and a title with a sub-title. Everything is well positioned beside the time the show should air and linked to the right text input in the "TEXTE" comp.

I put a little option where the person exporting the billboard could simply insert a "*" to make the title on 2 lines. I simply had to make sure that the right precomp appeared in the "RENDER" comp.

Here's what i put in the opacity of the precomps :

value=0;
if (comp("1. TEXTE").layer("EMISSION2_TITRE").text.sourceText.indexOf("*")!=-1) {value=100};

or

value=0;
if (comp("1. TEXTE").layer("EMISSION2_TITRE").text.sourceText.indexOf("*")==-1) {value=100};

In other words, the opacity is zero unless AE detects a "*" or doesn't detect a "*" in the respective layer.

Sorry for the lengthy post, and thanks for helping out! :)


Return to posts index


Roland R. Kahlenberg
Re: Detecting specific character in a text layer
on Nov 2, 2011 at 6:34:28 pm

Hi Yan, I actually understood what you were trying to accomplish within the larger scheme of things. I was just unclear about the way you were going about it.

I've done similar network stuff to what you're doing and I appreciate your issues. What you're doing is actually creating a UI (user-interface) to allow for variation. The problem you will have is that different users, including new users who have never used your 'software' will someday be opening up the AEP and trying to decipher what to do. The "*" may work for now but down the road, when a new user comes in, he/she may not know the protocol.

I still think that creating separate precomps with accompanying 'final' comps - coupled with placing these into properly named folders in the Project Panel will work best for both the short and long term.

HTH
RoRK

Intensive AE & Mocha Training in Singapore and Malaysia
Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer


Return to posts index

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