Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Dan Ebberts

    March 23, 2019 at 10:02 pm

    First you would loop through all currently selected layers and deselect each one. Then you would select the layer you want to apply the preset to.

    Dan

  • Juanluis Vich

    March 23, 2019 at 10:44 pm

    of course!
    thanks!

    I made it work with this
    Do you think the code is ok, or too messy? it’s working, btw ☺

    var myComp = app.project.activeItem;
    var mySelectedLayers = myComp.selectedLayers;
    ///
    for (var i = 1; i <= myComp.numLayers; i++){
    myComp.layer(i).selected = false;

    }

    ///
    for (var i = 1; i <= myComp.numLayers; i++){
    var myContents = myComp.layer(i).property("ADBE Root Vectors Group");

    for (var j = 1; j <= myContents.numProperties; j++){
    myContents.property(j).selected = true;
    app.executeCommand(3741);//group shapes

    }
    myComp.layer(i).selected = false;
    }

  • Dan Ebberts

    March 23, 2019 at 11:44 pm

    I think I might change that first loop to something like this:


    for (var i = 0; i < mySelectedLayers.length; i++){
    mySelectedLayers[i].selected = false;
    }

    but it looks pretty good.

    Dan

  • Juanluis Vich

    March 24, 2019 at 1:29 am

    thanks a lot for the help!!

  • Santi Agustí

    March 25, 2019 at 3:17 am

    Hi! sorry to bother with the group thing! I was giving a try to the script you posted here with different kind of grouping ( shape layer with 4 pre- groups to group, another shape layer with 3 and 2).
    Then I found a really odd behaviour when applying the script, it generates a group with several unexpected subgroups, it always creates the same pattern, groups inside groups,( and letting one element outside the group and when selecting more than 2 groups to group).

    I added an image to try to make it a bit more clear.

    On the image, I was trying to group the groups (001,002,003,004) into a single group, but everything seemed to work with that strange behaviour

    I also added the same file I was applying the script into, just in case
    13221_groupsmadness.aep.zip

    I don’t know if there is some line to tweak the script to avoif that infinite looping of creating subgroups when calling the command (3741) or maybe its some kind of bug or limitation when grouping via calling the command with the script?

Page 2 of 2

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