Thursday, July 27, 2017

#1 2017-07-12 01:00:21 pm

dklucznik
Member
Registered: 2005-07-19
Posts: 77

resizing rectangle box

I must be getting old. I can't figure this out...

Applescript:


   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

Offline

 

#2 2017-07-12 05:28:25 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 755

Re: resizing rectangle box

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.

Applescript:

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

Last edited by Marc Anthony (2017-07-13 05:05:18 pm)

Offline

 

#3 2017-07-13 11:46:25 am

dklucznik
Member
Registered: 2005-07-19
Posts: 77

Re: resizing rectangle box

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.

Applescript:


--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

Offline

 

#4 2017-07-13 12:50:44 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 755

Re: resizing rectangle box

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.

Applescript:


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

If you're supplying all the dimensions:

Applescript:


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

Last edited by Marc Anthony (2017-07-13 05:05:52 pm)

Offline

 

#5 2017-07-13 02:27:08 pm

dklucznik
Member
Registered: 2005-07-19
Posts: 77

Re: resizing rectangle box

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

thnks for you help
david

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)