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

Creating a script to add control sliders based on selected properties, but get rid of duplicants.

Explorer ,
Dec 13, 2018 Dec 13, 2018

{

    var control=app.project.item(findIndex()).layer(1);

    for (var i=0; i<x.length; i++)

   {

    var propsName=x.name;

    if(x.canSetExpression)

    {

    var customMax=app.project.item(findIndex()).layer(1).effect.addProperty("ADBE Slider Control");

    customMax.name="Inner "+propsName+" Value";

    control.effect("Inner "+propsName+" Value").property("Slider").setValue(100);

    var customMin=app.project.item(findIndex()).layer(1).effect.addProperty("ADBE Slider Control");

    customMin.name="Outer "+propsName+" Value";

   }

}

       

}

Above is the script I have right now, and it's purpose is to add slider controls to my control layer based on the currently selected properties. (x is acting as the selected properties here). The only issue I have, is I only want one set of sliders to control the same property in every layer, but this script creates individual sliders for each layer. So basically I need a way to filter through the property name to make sure it hasn't already been made.

TOPICS
Scripting
2.6K
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

correct answers 1 Correct answer

Advocate , Dec 13, 2018 Dec 13, 2018

Run through the array and create a new pair of slider only if you actually need it (check before creating if the slider with the required name already exists). Something like this:

var control=app.project.item(findIndex()).layer(1);

for (var i=0; i<x.length; i++){

   

    if (!x.canSetExpression) continue;

   

    var propsName=x.name;

    var customMax_name = "Inner "+ propsName +" Value";

    var customMin_name = "Outer "+ propsName +" Value";

   

    if (!control.effect(customMax_name)){

        cont

...
Translate
Advocate ,
Dec 13, 2018 Dec 13, 2018
LATEST

Run through the array and create a new pair of slider only if you actually need it (check before creating if the slider with the required name already exists). Something like this:

var control=app.project.item(findIndex()).layer(1);

for (var i=0; i<x.length; i++){

   

    if (!x.canSetExpression) continue;

   

    var propsName=x.name;

    var customMax_name = "Inner "+ propsName +" Value";

    var customMin_name = "Outer "+ propsName +" Value";

   

    if (!control.effect(customMax_name)){

        control.effect.addProperty("ADBE Slider COntrol").name = customMax_name;

        };

    if (!control.effect(customMin_name)){

        control.effect.addProperty("ADBE Slider COntrol").name = customMin_name;

        };

   

    //    x.expression = // something using customMax_name and customMin_name

    };

Xavier

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