Thanks Ed, Stan and Shane for these replies. The
following is working. I never considered setting the geometric bounds twice.
Thanks again.
set the theBox to make rectangle with properties
{geometric bounds:{.005 h2, .045, h3}, stroke weight:”0”}
place theImage on theBox
tell item 1 of theBox
set topImage to graphic 1 of theBox
set geometric bounds of topImage to {.005, h2,
.045, h3}
fit given center content
end tell
--------------------------
In CS2, you can adjust the geometric bounds of the image,
just as you do the rectangle.
Like this:
tell application "Adobe InDesign CS2"
tell document 1
tell page item 1
tell image 1
set geometric bounds to {2.0, 5.5, 15.0, 20}
end tell
end tell
end tell
end tell
HTH,
ES
----------------------
Hi Mark,
In fact, what Ed suggests is the only way to control the
absolute position an image.
There¹s a big difference between scripting images in
InDesign and using the GUI. In the GUI, an image's geometric bounds are
relative to it's containing rectangle, so when you move a rectangle, the image
goes along for the ride.
But when scripting, both the rectangle's and the image's
bounds are relative to the page, not each other. So if you reposition the
rectangle, you must separately reposition the image.
InDesign's 'fit' AS command does provide a way to
position an image relative to its containing rectangle, but only if one of the
command options does what you need (center, proportional fit, etc.). If not,
you'll need to calculate new geometric bounds for both rectangle and image and
reposition them individually.
Stan C.
----------------------
You can also use the move command to move just the image,
as the OP wants:
tell application "Adobe InDesign CS4"
tell document 1
move image 1 of rectangle 1 by {100, 0}
end tell
end tell
> So if you reposition the rectangle, you must
separately reposition the image.
It would probably be better to say that if you change the
bounds of one, it is independent of the other. But if you reposition a
rectangle using the move command, like this:
tell application "Adobe InDesign CS4"
tell document 1
move rectangle 1 by {100, 0}
end tell
end tell
the image goes along for the ride.
--
Shane Stanley <email@hidden>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>