Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Make a script to parent bottom layer to current selected layer.

  • Make a script to parent bottom layer to current selected layer.

    Posted by Carlos Pendas on February 16, 2017 at 5:51 am

    Hello, I’ve got this very repetitive task that I perform dozens of times per hour, I need to parent the layer right under the selected layer to the selected layer. Ideally I would assign a shortcut to this script.

    Problem is, I read through the documentation, searched forums and I can’t understand how to do it. Can anyone point me in the right direction?

    Thanks!

    Dan Ebberts replied 9 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    February 16, 2017 at 6:52 am

    This should get you headed in the right direction:


    var myComp = app.project.activeItem;
    var myLayers = myComp.selectedLayers;
    if (myLayers.length > 0){
    var myLayer = myComp.selectedLayers[0];
    if (myLayer.index < myComp.numLayers){
    myComp.layer(myLayer.index +1).parent = myLayer;
    }
    }

    Dan

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