Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Dan Ebberts

    June 16, 2017 at 5:50 pm

    The only way I know of is to select the shapes and then have the script execute the “Group Shapes” menu command.

    Dan

  • Mahdi Mor

    June 16, 2017 at 6:46 pm

    thanks , 1 more Q .
    how can i select them (by script ).??

  • Dan Ebberts

    June 16, 2017 at 7:12 pm

    Something like this, probably:


    var myContents = myLayer.property("ADBE Root Vectors Group");
    myLayer.selected = false;
    for (var i = 1; i <= myContents.numProperties; i++){
    myContents.property(i).selected = true;
    }

    It might depend on how your shape layer is structured.

    Dan

  • Mahdi Mor

    June 16, 2017 at 7:22 pm

    yay ,thank you very much.

  • Juanluis Vich

    March 9, 2019 at 1:40 am

    hi!
    I was trying to group some shape props along a bunch of selected layers, but it seems I cannot make it work on all the selected layers, but only on the first one.
    Is there a chance to make it work so I can select some layers, and then apply the script so all the contents they have inside get grouped without stoping once the first layer is done? Maybe that’s not possible and it should work on every layer individually?
    this is the code I was trying to make work:

    var myLayers = app.project.activeItem.selectedLayers;
    var myLayer;
    for (var i = 0; i < myLayers.length; i++){

    myLayer = myLayers[i];
    var myContents = myLayer.property("ADBE Root Vectors Group");
    myLayer.selected = false;
    for (var i = 1; i <= myContents.numProperties; i++){
    myContents.property(i).selected = true;
    app.executeCommand(3741);//group shapes
    }

    }

    Thanks!

  • Dan Ebberts

    March 9, 2019 at 3:11 am

    You have a nested loop where you’re using the same loop variable name (i) for both loops. You need to change one of them. I usually use j for the inner loop.

    Dan

  • Juanluis Vich

    March 9, 2019 at 4:11 am

    oh! thanks! I missed that!

    I changed the inner loop to be j, but it seems the execute command is not working at all. Its weird, when I select the layers individually, it works great, but if more than 1 layer is selected, it just loops and selects all the properties at the same but no grouping at all…

  • Dan Ebberts

    March 9, 2019 at 4:35 am

    I don’t know for sure, but maybe the menu command doesn’t work if more than one layer is selected. If that’s the case, you’ll probably have to make sure the layers are selected one at a time before you start the inner loop.

    Dan

  • Juanluis Vich

    March 9, 2019 at 6:21 am

    mm yes, it seems it will have to work that way… thanks for the ideas!

  • Juanluis Vich

    March 23, 2019 at 9:25 pm

    hi!
    I’ve been trying to figure out how to make sure the layers are selected one at a time before starting the inner loop with no luck… do you have any hint or ref to get the right direction?
    Thanks!

Page 1 of 2

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