Selecting Graphic inside frame after it's been placed in InDesign CS

I’m trying to place an image in InDesign CS and scale it to fit the frame.
I’m running into a problem once the Image has been placed:


tell myPage
				set myImage to make rectangle with properties {geometric bounds:{0.25, 0.25, 12.8, 20.5}}
				set myPlacedImage to place placedImage on myImage
				set myItem to page item 1
				select myItem

So that all works… but then I do:


set theSelection to selection

and it errors. So… how exactly do I select the contents of myImage in order to “fit given content to frame”?

I’ve been looking all day on Adobe’s forums, site, AS sites, etc. and googling the heck out of the web…

any help appreciated.

:confused: Aa

In short you don’t, you use the “Fit” command:

tell myPage
               set myImage to make rectangle with properties {geometric bounds:{0.25, 0.25, 12.8, 20.5}}
               set myPlacedImage to place placedImage on myImage
              fit rectangle myImage given proportionally --given  content to frame/frame to content/center content/proportionally

Hey! Thanks, I figured out that I had to omit the rectangle part of that last line of code to make this work.]
Thanks again, I appreciate it.

:confused: Áa

Sorry I wasn’t thinking and didn’t actually run the code. The line:

set myPlacedImage to place placedImage on myImage

returns the object reference of the rectangle so the “rectangle” in the line is not need and will return an error:

fit rectangle myImage given proportionally

ooooh-kaaay. So new problem :rolleyes:
How do I get the properties of the placed image? If I get properties of myImage, I get the properties of the rectangle, correct?
Basically, What I’m doing here is trying to build a very simple auto lay up script, so I need the placed image name and scale passed
to a var so I can dump them to a text box. And no offense, but the scripting indesign guide is somewhat useless to me, probably
because I don’t know applescript too well. Would anyone be willing to put up some tutorial code?

Thanks for pointing out why “rectangle” was erroring.

:confused: Aa

Nevermind. Figured it out. Thanks for all the help, I never would have figured out how to scale the images. :smiley:

:confused: Aa