3 Replies Latest reply on Jun 7, 2008 11:44 AM by (Olav_Kvern)

    simply group objects on a page

      hello from France,

      I can find a way to group two identified items on a page. It is certainly very simple but i've missed it :) However, for a simple thing like this i can't find anywhere a clear and simple example in the manuals & tutorials

      As i didn't find a command for telling two page items to be grouped, i have used the "make" command like this:
      tell application "Adobe InDesign CS3"
      tell document 1
      set listItems to the object reference of the page items of page 1
      make new group at beginning of page 22 with properties {all page items:{item 1 of listItems, item 5 of listItems}}
      end tell
      end tell

      I also tried other combinations with the make command with no result: at best, i have that error message (roughly translated from french: in parenthesis, i have put my doubts about the translation):
      "needed value is missing for the setting (or property or class?) 'group items' of the event (or command ?) 'make'"

      Someone could help me on this? Thanks!

      nota: however, apart from that little pb, coming from XPress, Applescript support in InDesign is refreshingly powerful and simple to handle :))
        • 1. Re: simply group objects on a page
          sstanleyau Level 4
          On 7/6/08 6:55 PM, "Vincent Pelletier" <member@adobeforums.com> wrote:<br /><br />> set listItems to the object reference of the page items of page 1<br />> make new group at beginning of page 22 with properties {all page items:{item 1<br />> of listItems, item 5 of listItems}}<br /><br />If the items are on page 1, you can't make the group on page 22. You also<br />need to use the "group items" parameter. Try this:<br /><br />set listItems to the object reference of the page items of page 1<br />make new group at beginning of page 1 with properties {group items:{item 1<br />of listItems, item 5 of listItems}}<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
          • 2. Re: simply group objects on a page
            Level 1
            Thank you for your quick reply!

            I have seen the error after posting, but after correcting it, the problem still occured.
            Sorry to have you directed on the bad trail!

            In parallel i have posted another help message in the macscripter's forums where someone have found the error, which i found after testing was somehow a bug.
            For anyone interested, the post and the replies are located here:
            http://bbs.macscripter.net/viewtopic.php?pid=100131#p100131

            To resume: i found that when you set the group properties you must use "group items", but when you want to make a reference to a group's page item, it's the "all page items" property that you have to use!!

            Anybody has ever encounter that?

            Vincent
            • 3. Re: simply group objects on a page
              Level 1
              Hi Vincent,

              No, you shouldn't use "all page items" for this. If you do that, you'll get items inside other items, and also items within groups that might be inside the group. "All page items" is a flattened list of all of the objects in a given container, regardless of their nesting. Instead, you can use the page items collection of the group. Only use "all page items" when you want to get at objects regardless of their posiition in the hierarchy.

              Instead, you can use:

              --given a group "myGroup"
              set myPageItem to page item 1 of myGroup
              --or, to get a collection of all page items in the group:
              set myPageItems to page items of myGroup

              Thanks,

              Ole