resizing rectangle box

I must be getting old. I can’t figure this out…


	tell page 1 of document 1
		--set myBox1 to make rectangle with properties {geometric bounds:{0.1, 0.1, 4, 8.4}, stroke weight:"0"}
		--tell myBox1
		try
			set myBox1 to place file MyArtPDF
			
			
		on error
			display dialog "ART missing"
		end try

This places an 8-1/2 x 11 box on my page with the PDF inside it. All I need to do is resize the box to a small heigth to crop the bottom part of the PDF off. All I need to do is something like

set height of myBox1 to {4}

but that doesn’t work. What am I missing??

david

Hi. I’ll assume you are asking about InDesign bound geometry, which uses a formula {topmost, leftmost, (topmost + height), (leftmost + width)}. Height and/or width either have to be supplied or calculated from set dimensions; i.e., Height = bottommost - topmost, Width = rightmost - leftmost.

set theHeight to 4

tell application "Adobe InDesign CS3"'s document 1
	tell rectangle 1 --adjust to desired target
		set {TM, LM, BM, RM} to geometric bounds
		set geometric bounds to {TM, LM, TM + theHeight, RM}
	end tell
end tell

*edited some variable names for clarity

thanks for the info marc.

I tried it out with some success…
If I draw a box and get the bounds, it works… but if i place a pdf file using a similar command it doesn’t recognize the box as myBox1.


--set myBox1 to make rectangle with properties {geometric bounds:{0.1, 0.1, 4, 8.4}, stroke weight:"0"}
		set myBox1 to place file MyArtPDF
		set {TM_x1, LM_y1, BM_y2, RM_x2} to geometric bounds of myBox1
		display dialog TM_x1 & "   , " & LM_y1 & "   , " & BM_y2 & "   , " & RM_x2 as string

just trying to debug this… if i use the first line, “make rectangle…” then the display dialog returns the values.
if I use the second line, where I have used set myBox1 to place file… then the display dialog fails because it doesn’t see the bounding box of that placed file to be “myBox1”

this really shouldn’t be so difficult… sadly.
david

I can’t tell what version of the software you’re using or if the place command changed, but placing a file requires a destination specifier with mine, and the result of that operation is always an image, so your expected “myBox1” isn’t a rectangle. If you want to sample dimensions from the box, you want its parent.


(place (choose file) on make rectangle)'s item 1's parent -->container reference

If you’re supplying all the dimensions:


set {TM, LM, theWidth, theHeight} to {0.1, 0.1, 4, 8.4}

tell application "Adobe InDesign CS3"'s document 1
	place (choose file) on make rectangle with properties {geometric bounds:{TM, LM, TM + theWidth, LM + theHeight}}
end tell

*edited some variable names for clarity

Wow… when did this get so complicated.
We are using Indesign CC 2017.

thnks for you help
david