ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Attemping to disable all expressions in selected comp using Extendscript

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Keenan Parry
Attemping to disable all expressions in selected comp using Extendscript
on Sep 26, 2019 at 10:27:01 pm

Hi there. I'm trying to write a little script that disable every single expression in every layer of a selected comp. I'm having trouble finding a method or function that is able to look at every property, no matter what it is, and disable it. I've gotten as far as being able to disable a selected property, but it would be great to have a script that could disable expressions on a mass scale by itself. Any help appreciated, thank you!

var activeComp = app.project.activeItem;
app.beginUndoGroup('Disable Expressions');

for(var i = 0; i &lt; activeComp.selectedProperties.length; i++) {

var property = activeComp.selectedProperties[i];
if(property.expressionEnabled === true) {
property.expressionEnabled = false;
}else{

}


}
app.endUndoGroup();


Return to posts index

Oleg Pirogov
Re: Attemping to disable all expressions in selected comp using Extendscript
on Oct 29, 2019 at 3:36:12 pm

This should do it:

function disapbleExpressionsInPropertyGroup(propertyGroup){
var propertiesAdded = false;

for (var i=1; i<=propertyGroup.numProperties; i++){
var currentProperty = propertyGroup.property(i);

if (currentProperty.propertyType == PropertyType.PROPERTY){
try{
currentProperty.expressionEnabled = false;
}
catch(err){
}
}
else{
disapbleExpressionsInPropertyGroup(currentProperty);
}
}

return propertiesAdded;
}

function main(){
var activeItem = app.project.activeItem;

if (activeItem instanceof CompItem){
for (var i=1; i<=activeItem.layers.length; i++){
disapbleExpressionsInPropertyGroup(activeItem.layers[i]);
}
}
else{
alert("No composiotion is active");
}
}

main();


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]