Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Attemping to disable all expressions in selected comp using Extendscript

  • Attemping to disable all expressions in selected comp using Extendscript

    Posted by Keenan Parry on September 26, 2019 at 10:27 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 < activeComp.selectedProperties.length; i++) {

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

    }

    }
    app.endUndoGroup();

    Oleg Pirogov replied 6 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Oleg Pirogov

    October 29, 2019 at 3:36 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();

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy