I'm building a script that will need to select some images, and move their image boxes (parent), to the left or the right.
I have the script loop through an array of images(PDFs) in the document, and finds the ones I need by filepath
once the image path matches the requsted path, I find (and select for visual conformation) the parent (rectangle) of the image.
This all works. where my confusion lies is when it moves.
when I move it the parent moves, but the image stays in position. When you select the parent manuallly in indesign and move it that way the rectangle and image move together.
Why is this not working as expected.
for(var i=0; i<imageArray.length; i++)
var myCurrentimage = myDoc.pageItems.itemByID(imageArray[i]).itemLink.filePath;
if (myCurrentimage==ServiceHeader_6col )
var headerUsed = myDoc.pageItems.itemByID(imageArray[i]).parent
var headerBounds = headerUsed.geometricBounds;
headerBounds = 100
headerBounds = headerBounds +100
...When you select the parent manuallly in indesign and move it that way the rectangle and image move together...
Right but not when you drag parent controls to change parent's size (or position in fact).
Resetting box.geometricBounds means dragging controls rather than move.
Better way is to use move(to,[by]) method. In your case: