indesign newbie help

i have just started with applescript and my goal is to learn to script indesign.

i have looked at the documentation from adobe and made this script:


tell application "Adobe InDesign CS3"
	set myDocument to make document
	tell page 1 of myDocument
		set myRectangle to make rectangle
	end tell
end tell

how can i get the rectangle size to be the same as the size of the document??
(without hardcoding the size, because the document size changes)

Hi,
give this a try!

tell application "Adobe InDesign CS3"
	activate
	set myDocument to make document
	set {b, a, d, c} to bounds of page 1 of document 1
	
	tell page 1 of myDocument
		set myRectangle to make rectangle
		set geometric bounds of myRectangle to {b, a, d, c}
	end tell
end tell

Thanks,
Nik

that worked. thanks! :smiley:

when i put stroke on, the stroke grows from the middle leaving half the rectangle outside the bounds of the document.
anyone know how to avoid this??

HI,
Basically it creates a record of each coordinate and then the values from that record are telling the rectangle to make itself that size.
Hope that helps?
Thanks,
Nik

Hi Demi

Just amend Blend3’s script to this:

tell application "Adobe InDesign CS3"
	activate
	set myDocument to make document
	set {b, a, d, c} to bounds of page 1 of document 1
	
	tell page 1 of myDocument
		set myRectangle to make rectangle with properties {stroke alignment:center alignment}
		set geometric bounds of myRectangle to {b, a, d, c}
	end tell
end tell