Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Please assist with simple script

  • Please assist with simple script

    Posted by Syed Iqbal on June 27, 2015 at 5:38 pm

    Hi folks
    I have written 2 simple lines of code by taking online help. The code makes a duplicate of current layer but I am not being able to figure how can I turn the visibility off of the previous layer which was used to create this duplicate:

    var myComp = app.project.activeItem;
    var myLayer = myComp.layer(1).duplicate();

    I have tried something like this but it does not work:

    myLayer.index(-1).disabled;

    It seems I am not using correct syntax. Please help.

    Regards
    Syed

    var myComp = app.project.activeItem;
    var myLayer = myComp.layer(1).duplicate();
    myLayer.index(-1).disabled;

    Syed Iqbal replied 11 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 27, 2015 at 6:28 pm

    Try it this way:

    var myComp = app.project.activeItem;
    var myLayer = myComp.layer(1);
    var myNewLayer = myLayer.duplicate();
    myLayer.enabled = false;

    Dan

  • Syed Iqbal

    June 27, 2015 at 6:33 pm

    Hi Dan
    As usual you have advised an awesome trick. I have also tried the below code and it is also working:

    Thank you very much once again for your help.

    Regards
    Syed

    var myComp = app.project.activeItem;
    var myLayer = myComp.layer(1).duplicate();
    myComp.layer(2).enabled=false;

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