2 Replies Latest reply on Jul 6, 2009 1:20 AM by Roy Marshall

    [JS] CS3 Help with groups needed

    Roy Marshall Level 1



      I am formatting a page of text frames, and images, and trying to group the selected objects together.


      While formatting the pageI am gathering an array of variables:


      myGroupArray = new Array();
      myGroupCounter = 0;




      when I am finished a section, I want to group the contents of the vaiable 'myGroupArray'


      I am using this line:


      myGroup = myDoc.groups.add(myGroupArray);


      but getting an error 'Invalid value for parameter 'groupitems' of event 'add'. Expected Array o...t received("myTextFrame","myCorrectPic","myPriceFrame","mtQtyFrame").


      Can someone help me on this?





        • 1. Re: [JS] CS3 Help with groups needed
          [Jongware] Most Valuable Participant

          (Without actually trying it in ID)




          That adds a string to the array, not the frame. If "myTextFrame" is a variable pointing to a text frame, simply use




          By the way, have you been programming in other languages in the past? I have, and used




          as well until finding out that for arrays, this built-in array function works equally well:




          Types much faster, and if you need the number of elements, you can always use myGroupArray.length.

          • 2. Re: [JS] CS3 Help with groups needed
            Roy Marshall Level 1

            Many thanks Jongware.  A bit of a rookie mistake, would like to think I would have found this out for myself given time!!

            I will also use the.push method, as cuts out some steps for me.


            Thanks again,