Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Dmitry Baranau on January 1, 2021 at 6:17 pm

    Hello everyone, can anyone help me. How to select a layer below and a layer above with script. For example:

    Layer1

    Layer2

    Layer3

    We’re on layer2, how to select only layer3 below or just layer1 above. Thanks a lot for your help.

    My code is like this:

    var activeItem = app.project.activeItem;

    var selectedIndex = activeItem.selectedLayers [0] .index-1;

    activeItem.layer (selectedIndex) .selected = true;

    He should select the layer above. But it selects the current layer and the layer above, two layers at once.

    Dmitry Baranau replied 5 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    January 1, 2021 at 6:23 pm

    Maybe like this:

    var activeItem = app.project.activeItem;

    var selectedIndex = activeItem.selectedLayers [0].index;

    activeItem.layer (selectedIndex-1).selected = true;

    activeItem.layer (selectedIndex).selected = false;

  • Dmitry Baranau

    January 1, 2021 at 6:25 pm

    Thank you!!!! Happy New Year!

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