3 Replies Latest reply on Jul 24, 2011 12:17 PM by JJ0330

    Dynamically create group items in script?

    JJ0330 Level 1

      Want to be able to group all items in asset that we place on page but number of items can change based on asset and can be a lot of items so would like to create dynamically if possible?  Don't want to group beforehand in asset itself because need to manipulate indvidual items before grouping.

       

       

      tell application "Adobe InDesign CS5.5"
      tell library "GTElements.indll"
        set vAsset to "18"
      end tell
      set placedItems to place asset asset vAsset of library "GTElements.indl" on document 1

      -- can do as below manually

      set myGroup to make group with properties {group items:  {item 1 of placedItems, item 2 of placedItems, item 3 of  placedItems, item 4 of placedItems, item 5 of placedItems,  item 6 of placedItems, item 7 of placedItems, item 8 of  placedItems, item 9 of placedItems, item 10}}
      end tell

       

      --Anyway to dynamically create something like this or create some type of list and use that in group items:{}?
      set myGroupTest to make group with properties {group items:{items 1 through 10 of placedItems}}  -- or all items because can change --

       

      Thanks,

      Joe

        • 1. Re: Dynamically create group items in script?
          Muppet Mark Level 5

          I don't have your assets but if you can access them via 'item 1' etc it's an AppleScript list… As you have made a variable 'placedItems' you may be able to…

           

          set myGroupTest to make group with properties {group items:{placedItems}}

           

          failing that try…

           

          set myGroupTest to make group with properties {group items:{every item of placedItems}}

           

          untested…

          1 person found this helpful
          • 2. Re: Dynamically create group items in script?
            JJ0330 Level 1

            Thanks, I have tried a few variations of your suggestion but both get same error. 

             

            set myGroupTest to make group with properties {group items:{every item of placedItems}}

             

            Adobe InDesign CS5.5 got an error: Invalid value for parameter 'group items' of method 'make'. Expected list of page items, but received ((rectangle, rectangle, rectangle, rectangle, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame, rectangle, rectangle, rectangle, rectangle, text frame, text frame, text frame, text frame, text frame, text frame, text frame, text frame)).

            • 3. Re: Dynamically create group items in script?
              JJ0330 Level 1

              Think I finally got it!  Spent way too much time this weekend on this:)  Thanks for the help!

               

              select placedItems

              set myGroupTest to make group with data {group items:every item of selection}

              tell myGroupTest

              move to {0.25, 4}

              end tell