3 Replies Latest reply on May 8, 2013 9:17 PM by CarlosCanto

    (javascript) I want to group in existing pathitem


      <ai cs5><javascript>

      I creat 5 pathitem in the K_layer, i want to group them.


              var myDoc =  app.activeDocument;       

              var K_layer = myDoc.layers.add();

              var k01 = K_layer.pathItems.add();  k01.name='01';

              var k02 = K_layer.pathItems.add();  k02.name='02';

              var k03 = K_layer.pathItems.add();   k03.name='03';

              var k04 = K_layer.pathItems.add();  k04.name='04';

              var k05 = K_layer.pathItems.add();  k05.name='05';


              var mygroup = K_layer.groupItems.add();

              for (var i=0; i<K_layer.pathItems.length; i++)

                      K_layer.pathItems[i].move(mygroup, ElementPlacement.PLACEATEND);



           just 01,03,05 into the mygroup, 02,04 still in K_layer.

           I don't know why ?

      1.    I try K_layer.pathItems.length=5 is correct

      2.    and also i try

           K_layer.pathItems[0].move(mygroup, ElementPlacement.PLACEATEND);

           K_layer.pathItems[1].move(mygroup, ElementPlacement.PLACEATEND);

           K_layer.pathItems[2].move(mygroup, ElementPlacement.PLACEATEND);

           K_layer.pathItems[3].move(mygroup, ElementPlacement.PLACEATEND);

           K_layer.pathItems[4].move(mygroup, ElementPlacement.PLACEATEND);

           stop in the pathItems[3] and show 「error 1302 no such element」


      anybody to help, thx~