Skip navigation
matt.white
Currently Being Moderated

Script to group all items on a layer on the active page

Mar 26, 2012 8:44 AM

Hi,

I am struggling to get the correct syntax for this bit of my script.

I need to group all the items on a slug layer of my indesign document, but only on the active page.

 

This is as far as I have got:

 

tell application "Adobe InDesign CS5"

activate

 

          tell document 1

                    set myItems to the active page's page items whose item layer's name is "Slug" --this line does not work

  select myItems

                    set myselection to selection

  make group with properties {group items:myselection}

          end tell

 

end tell

 

I have tried many variations of this, but have not made anthing that works yet.

Any help would be much appriciated.

 

Thanks,

Matt

 
Replies
  • Currently Being Moderated
    Mar 26, 2012 9:40 AM   in reply to matt.white

    This seems to work:

     

    tell application "Adobe InDesign CS5"


        activate


        set myDoc to the active document


        set myLayer to layer "Slug" of myDoc


        set myPage to the active page of the active window


        set myItems to the page items of myPage whose item layer is myLayer


        tell the parent of myPage to make group with properties {group items: myItems}


    end tell

     

    active page belongs to the layout window (which belongs to the application), not the document. Also—there's no reason to select the items; you can just add them to your group. And I think you always want to add the group to the spread rather than any other unit.

     

    Jeff

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points