Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Source text as thisComp.name but also have it lowercase

  • Source text as thisComp.name but also have it lowercase

    Posted by Johnny Opamo on January 20, 2020 at 11:07 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!

    Dan Ebberts replied 5 years, 11 months ago 3 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    January 20, 2020 at 11:24 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

  • Johnny Opamo

    January 20, 2020 at 11:52 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!

  • Johnny Opamo

    January 20, 2020 at 11:54 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!!

  • Johnny Opamo

    January 21, 2020 at 2:13 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

  • Dan Ebberts

    January 21, 2020 at 5:05 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

  • Louise Nylund

    September 30, 2020 at 5:02 pm

    Hi! I’m rather new to expressions. Is there a way to use this method but have the comp name be divided into three rather than two separate strings, in order to get three layers of text resulting from the comp name? I have lower thirds with three text lines (name, job title, company) that I would like to automate by populating each of the layers’ source text with parts of the comp name. The formatting differs between the text layers so I think it would be trickier to have all the lines in one paragraph, right?

    I don’t need to worry about the lowercase part, just want the three text layers to take their source text from the comp name.

  • Dan Ebberts

    September 30, 2020 at 5:51 pm

    Sure. If you use a separator character that’s unlikely to occur otherwise in the text (say, the pipe (|) character, then you could use expressions like this:

    thisComp.name.split("|")[0]; // name

    thisComp.name.split("|")[1]; // job title

    thisComp.name.split("|")[2]; // company

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy