Skip to main content
mart-martinlofqvist
Known Participant
September 24, 2023
Answered

Fetching text from Essential Graphics gives me wrong result when I split it?

  • September 24, 2023
  • 1 reply
  • 344 views

Hi! 

 

I'm building a template .mogrt where I'm holding the source text as a attribute in the Essential Graphics template. It seems as if After Effects is treating the text in different ways depending on if the text is being fetched from the template or not. On a separate layer to the original text I have made two Slider Controls:

On the first Slider I have set the variable t with the entire source text, on the next line I say "t = t.split(" ");" and I end with "t.length;". This gives me 65 which is the correct number of words or characters separated by a space. 

On the other Slider Control 

"t = thisComp.layer("txt").text.sourceText; t = t.split(" "); t.length;" where the layer txt holds the entire source text from Essential Graphics.

This gives me 123 which is not the correct. 

 

The only thing I can think of is that the application runtime handles requests from Essential Graphics after the ordinary Expressions is executed? 

 

Is there a way to solve this? 

This topic has been closed for replies.
Correct answer ShiveringCactus

I found that if I need to use an expression on text in an Essential Graphics comp, it would work if I used a hidden text layer and pointed the source text of the visible layer to it.  My guess is that the expressions are running before the EG properties as far as text is concerned and this workaround solves it.

1 reply

ShiveringCactus
Community Expert
ShiveringCactusCommunity ExpertCorrect answer
Community Expert
September 25, 2023

I found that if I need to use an expression on text in an Essential Graphics comp, it would work if I used a hidden text layer and pointed the source text of the visible layer to it.  My guess is that the expressions are running before the EG properties as far as text is concerned and this workaround solves it.

mart-martinlofqvist
Known Participant
September 25, 2023

This seems to work! 

 

thanks a bunch for the idea.