-
Skipping Hidden Properties with ExtendScript
Hey there, I have this script that scrubs through the active comp and automatically enables all expressions that are disabled in the comp. This works great until the composition has “Hidden Properties” and it gives me an error. Basically any effect like Grid or a Light Layer that will hide properties that are being unused. Those stop the script dead in its tracks and I’d like to make a Try Catch to simply skip these properties and move onto the next one. However, I’m having trouble implementing this as I’m new to extendscript. I’ve seen things like PropertyValueType.NO_VALUE or CUSTOM_VALUE, but I’m kinda lost on how to get this to work. Any help is appreciated!
(function() {
function recursiveDisableExpressions(propertyGroup) {
for (var i = 1; i <= propertyGroup.numProperties; i++) {
var property = propertyGroup.property(i);if (property instanceof PropertyGroup) {
recursiveDisableExpressions(property);
continue;
}if (!property.canSetExpression) {
continue;
}if (!property.isModified) {
continue;
}if (property.expressionEnabled === false) {
property.expressionEnabled = true;
}
}
}app.beginUndoGroup("Disable All Comp Expressions");
var comp = app.project.activeItem;
for (var i = 1; i <= comp.numLayers; i++) {
var layer = comp.layer(i);recursiveDisableExpressions(layer);
}app.endUndoGroup();
})();