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

Target a specific comp by name and add Slider

Community Beginner ,
Apr 03, 2024 Apr 03, 2024

Copy link to clipboard

Copied

Hi everyone!

I have a couple of Nulls inside Comp 2 and this comp is a precomp inside Comp 1. 

 

I need to create a script that checks if there is an effect in  the selected Null then add the same effect to Comp 2.  This is only for Checkboxes and Sliders, nothing major. 

 

I think one of the reasons this is not working is because I'm using the activeItem. The script needs to look for a specific comp name because my projects have many layers and sorting by items indexes might not always work.  

 

I feel that adding the expressions to link both parameters later would be very simple once I understand how the heck to access Comp 2 from within it. 

 

This is what I have so far:

var myComp;
for (var i = 1; i <= app.project.numItems; i ++) {
    if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name === 'Comp 2')) {
        myComp = app.project.item(i);
        break;
    }
}

var baseComp = myComp.layer("Comp 2");
var baseCompSlider = baseComp.effect.addProperty("ADBE Slider Control");

alert (myComp.name + selectedLayer.name);

 

I know I'm kinda crazy and perhaps the idea is redundant, but please help this crazy guy solve this rittle. I'm learning to code. 

 

Thank you.

TOPICS
Experiment , Expressions , Scripting

Views

56

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation