Copy link to clipboard
Copied
I've added an additional check if the expression can be set for the chosen property.
if (app.project.activeItem instanceof CompItem) {
var comp = app.project.activeItem;
var selectedLayer = comp.selectedLayers[0];
if (selectedLayer) {
// Check if the layer has effects
if (selectedLayer.property("ADBE Effect Parade").numProperties > 0) {
var effectGroup = selectedLayer.property("ADBE Effect Parade");
var lastEffect = effectGroup.property(effect...
Copy link to clipboard
Copied
I've added an additional check if the expression can be set for the chosen property.
if (app.project.activeItem instanceof CompItem) {
var comp = app.project.activeItem;
var selectedLayer = comp.selectedLayers[0];
if (selectedLayer) {
// Check if the layer has effects
if (selectedLayer.property("ADBE Effect Parade").numProperties > 0) {
var effectGroup = selectedLayer.property("ADBE Effect Parade");
var lastEffect = effectGroup.property(effectGroup.numProperties);
// Check if the last effect has checkboxes
if (lastEffect.numProperties > 0) {
var checkbox1 = lastEffect.property("Uniform"); // Change to the actual name
var checkbox2 = lastEffect.property("Individual"); // Change to the actual name
// check if expected effect is present and expression can be set
if (checkbox1 !== null || (!checkbox1.canSetExpression)) {
alert("Cannot set expression for the property: " +
selectedLayer.name + "." + lastEffect.name + ".Uniform");
} else {
checkbox1.expression = 'value;';
}
if (checkbox2 !== null || (!checkbox2.canSetExpression)) {
alert("Cannot set expression for the property: " +
selectedLayer.name + "." + lastEffect.name + ".Individual");
} else {
checkbox2.expression = 'value;';
}
}
} else {
alert("No effects found on the selected layer.");
}
}
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more