Sunday, May 9, 2021

#1 2021-04-29 10:48:27 am

sruhler@icloud.com
Member
Registered: 2021-04-26
Posts: 2

Indesign "all page items" Applescript ignores graphic frames

Hello,

I have script I've been working on that will (hopefully) select all  page items, group them and then duplicate them on an expanded document size, ( think of a gang up or imposition). It works great until I add a graphic frame to the page and then I get "invalid parameter" error at the group line of code. I've posted the script as it stands now,
Thanks in advance

Applescript:

tell application "Adobe InDesign 2021"
   set myDocument to document 1
   tell document preferences of myDocument
       set myPWidth to page width
       set myPHeight to page height
   end tell
end tell
tell application "Adobe InDesign 2021"
   set myPage to page 1 of myDocument
   tell myPage
       set myRectangle to make rectangle with properties {geometric bounds:{myPHeight, 0, 0, myPWidth}}
       tell myRectangle
           set fill color to "None"
           set stroke color to "None"
           
       end tell
   end tell
end tell
tell application "Adobe InDesign 2021"
   set myDocument to document 1
   tell document preferences of myDocument
       set myNewPWidth to page width * 2
       set myNewPHeight to page height * 2
       set page width to myNewPWidth
       set page height to myNewPHeight
   end tell
end tell
tell application "Adobe InDesign 2021"
   set thisPage to page 1 of active document
   set myGroup to make group at parent of item 1 of (all page items of thisPage) with properties {group items:(all page items of thisPage)}
   move myGroup to {0, 0}
   duplicate myGroup to {0, myNewPHeight / 2}
   duplicate myGroup to {myNewPWidth / 2, 0}
   duplicate myGroup to {myNewPWidth / 2, myNewPHeight / 2}
   
end tell


Filed under: Indesign, imposition

Offline

 

#2 2021-04-29 12:03:40 pm

sruhler@icloud.com
Member
Registered: 2021-04-26
Posts: 2

Re: Indesign "all page items" Applescript ignores graphic frames

I knew  I posted too quickly, this seems to work

Applescript:


--This script will create a 4 up gang no bleed

tell application "Adobe InDesign 2021"
   set myDocument to document 1
   tell document preferences of myDocument
       set myPWidth to page width
       set myPHeight to page height
   end tell
end tell
tell application "Adobe InDesign 2021"
   set myPage to page 1 of myDocument
   tell myPage
       set myRectangle to make rectangle with properties {geometric bounds:{myPHeight, 0, 0, myPWidth}}
       tell myRectangle
           set fill color to "None"
           set stroke color to "None"
           --creates bounding box
       end tell
   end tell
   tell application "Adobe InDesign 2021"
       tell document 1
           set thespread to active spread of layout window 1
           make group at thespread with data {group items:every page item of thespread}
           
       end tell
   end tell
   tell application "Adobe InDesign 2021"
       set myDocument to document 1
       tell document preferences of myDocument
           set myNewPWidth to page width * 2
           set myNewPHeight to page height * 2
           set page width to myNewPWidth
           set page height to myNewPHeight
       end tell
   end tell
   tell application "Adobe InDesign 2021"
       set myDocument to document 1
       
       set myPage to page 1 of myDocument
       set myGroup to group 1 of myPage
       move myGroup to {0, 0}
       duplicate myGroup to {0, myNewPHeight / 2}
       duplicate myGroup to {myNewPWidth / 2, 0}
       duplicate myGroup to {myNewPWidth / 2, myNewPHeight / 2}
       --create 4 up gangup
       
   end tell
end tell

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)