Skip to main content
Known Participant
November 10, 2021
Question

If/Else expression referencing contents of Comp Name

  • November 10, 2021
  • 2 replies
  • 323 views

I have a bunch of comps, and certain comps require different icons. Instead of manually going in and changing each icon for the specific comp, I’d to just drag all the icons into every comp and reference the contents of the comp name.

Theres video’s per section, every section has 3 video’s and each section has its own icon.

For one section of video’s, comp names are: Careful Close Mindset, Careful Close Approach, Careful Close Skill.

 

I’d like to ask after effects “If this comp name contains these words, do this”. Is there a way to do that?

 

So the idea/expression I’d like on opacity is as follows;

if (thisComp.name [not sure what to put here] “Careful Close”) {100}

else {0}

 

Thanks in advance!

This topic has been closed for replies.

2 replies

Mylenium
Legend
November 10, 2021

if(regEx.match("Careful Close"*) == true)

{do this}

else

{do that}

 

You can of course go all fancy on the regex or expand this using JvaScript's native string methods to split substrings or whatever to harden the expression and make it more safe, but that's the basic drill.

 

Mylenium

Meng Zhiqun
Inspiring
November 10, 2021

You can try this.

if(thisComp.name == "//something"){
100;
}else{
0;
}
Known Participant
November 10, 2021

Not sure "==" works, as the comp names aren't EXACTLY "Careful Close", but have a word after "Careful Close". for example, "Careful Close Skill".

I'm basically trying to ask:

if (thisComp.name CONTAINS "Careful Close") {100}
else {0}