Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

If/Else expression referencing contents of Comp Name

Explorer ,
Nov 10, 2021 Nov 10, 2021

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!

TOPICS
Expressions , Scripting
198
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 10, 2021 Nov 10, 2021

You can try this.

if(thisComp.name == "//something"){
100;
}else{
0;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 10, 2021 Nov 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}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 10, 2021 Nov 10, 2021
LATEST

If that's the case, you can do if(thisComp.name.indexOf("//something") != -1){

//do this;

}else{

// do that;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 10, 2021 Nov 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines