Copy link to clipboard
Copied
{
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.
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
Copy link to clipboard
Copied
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
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more