Adobe After Effects Expressions Forum
Source text as thisComp.name but also have it lowercase
Source text as thisComp.name but also have it lowercase
by Johnny Opamo on Jan 20, 2020 at 11:07:38 pm

Hi there,

I'm just getting into expressions and looking for ways to speed up some of the more repetitive aspects of my workflow. A client sends me a folder with an artist's project name in the title, I usually have to copy and paste the text from the folder to the project name until I found the below solution.

I have a comp which has two bits of text and the comp name is "ARTIST // TITLE" for example.

The expressions I'm using are:

* for the Artist text*

compName = thisComp.name
compName.substring(0, compName.indexOf('//'))

* for the Title text *

compName = thisComp.name
compName.substring(compName.indexOf('//')+2)

This is really helpful at splitting the artist text and the title text but the branding for the team I'm working with has all their text lowercase and the comp names are in sentence case. What can expression can I add to this so that I am able to have the text within the comp all lowercase regardless of the case of the comp if that makes sense?

To add to this, is there anyway I can add text to the end of my comp's name without it appearing in the text? Like a piece of text that the expression could ignore? For example, I'd like to specify in the comp's file name that the footage is "1:1" or "9:16" but I don't want this text to appear in the artist or title text.

Every week there's a huge amount artist text titles I have to input manually and this would have me a bunch of time!

Any help with this would be massively appreciated.

Thanks in advance!


Re: Source text as thisComp.name but also have it lowercase
by Dan Ebberts on Jan 20, 2020 at 11:24:01 pm

>What can expression can I add to this so that I am able to have the text within the comp all lowercase regardless of the case of the comp

Like this maybe:

compName = thisComp.name.toLowerCase();


> is there anyway I can add text to the end of my comp's name without it appearing in the text?

You could maybe preface the info with a character that would never appear in the artist or title text, like "~":

~16:9

and then change the second expression to something like this:

compName = thisComp.name.toLowerCase();
compName.substring(compName.indexOf('//')+2,compName.indexOf('~') )


Dan




Re: Source text as thisComp.name but also have it lowercase
by Johnny Opamo on Jan 20, 2020 at 11:52:55 pm

Hey Dan,

Thanks for this. I think it's close. I've tried the expression you wrote for lowercase before and after the expression I already have. Before it ignores it, after it adds everything in lowercase but then also adds in the title text for example everything after "// title" which I'd like the artist text to ignore.

The second expression for the title text with the lowercase and ignoring a specific phrase works perfectly. Thanks for your help so far!


Re: Source text as thisComp.name but also have it lowercase
by Johnny Opamo on Jan 20, 2020 at 11:54:11 pm

Actually I've just tried that first expression but sandwiched it in the line between the original expression so it now works. Thanks Dan!!


Re: Source text as thisComp.name but also have it lowercase
by Johnny Opamo on Jan 21, 2020 at 2:13:28 am

Hey Dan,

Just to follow on from this. Everything's working well but there are artist names for example that are too long. I'm able to scale them down to fit the comp but what I'm really looking for now is a line break so I can keep the source text linked with the comp name but also be able to have the artist name on two separate lines.

Is there any way to do this?

As a reminder

artist text expression is:

compName = thisComp.name
compName = thisComp.name.toLowerCase();
compName.substring(0, compName.indexOf('//'))

title text expression is:

compName = thisComp.name
compName.substring(compName.indexOf('//')+2)
compName = thisComp.name.toLowerCase();
compName.substring(compName.indexOf('//')+2,compName.indexOf('--') )

Thanks in advance


Re: Source text as thisComp.name but also have it lowercase
by Dan Ebberts on Jan 21, 2020 at 5:05:09 am

As a simple example, if you wanted to split long names at the first space character, you could do something like this:

maxLength = 20;
compName = thisComp.name;
compName = thisComp.name.toLowerCase();
n = compName.substring(0, compName.indexOf('//'));
n.length > maxLength ? n.replace(" ", "\r") : n


Dan







© CreativeCOW.net