Jump to content
Sign in to follow this  
martober

Can AE count characters and return number for an expression?

Recommended Posts

I am writing an expression in After Effects.

 

I need to get the number of characters in a block of text (including spaces) fed in to an expression.

 

For example the phrase "After Effects" would yield the number 13. This number would need to be fed into a Range Selector start keyframe.

 

Can AE count characters? Any help is much appreciated.

Edited by martober

Share this post


Link to post
Share on other sites

i am pretty sure it can i looked through one of our scripts and i think this is the core of the code.

 

if (text.length > 12){

var diff = text.length - 12;

 

i would head over to AE enhancers, and ask dan brown or bryon nash, the script i have is a combination of their work

Share this post


Link to post
Share on other sites
I am writing an expression in After Effects.

 

I need to get the number of characters in a block of text (including spaces) fed in to an expression.

 

For example the phrase "After Effects" would yield the number 13. This number would need to be fed into a Range Selector start keyframe.

 

Can AE count characters? Any help is much appreciated.

 

First, let's make sure you need an expression. If you use "index" instead of "percentage" in the Advanced>Units, your Range will be based on character numbers rather than percent.

 

Otherwise, as RustyAce pointed out, "length" is the length in characters of a string. Like...

 

myText = text.sourceText;

myText.length

 

 

myText.length would equal an integer number that is the length of the source text, assuming it isn't an array.

 

 

My token plug... this is all covered quite thoroughly in Lesson 4 of the expressions series, FWIW.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...