InDesign simple frame mover

I use a simple script to increase or decrease the height of a frame (containing an image) in InDesign. This works perfectly for simply tweaking the top or bottom of the frame, as the placed image retains its position on the page (just the frame moves).

But, how can I tweak the script so that I can move the whole frame, and the image inside it (ie, move the whole thing up or down slightly)?

Here’s the portion of my basic script that increases frame height:

set heightIncrease to 1.764 -- Change this number to half the value of your baseline gap in mm
tell application "Adobe InDesign CS5.5"
	tell active document
		set theFrame to item 1 of selection
		set theBounds to geometric bounds of theFrame
		set geometric bounds of theFrame to {item 1 of theBounds, item 2 of theBounds, ((item 3 of theBounds) + heightIncrease), item 4 of theBounds}
	end tell
end tell

Model: MacPro Qaud Xeon
AppleScript: 2.4
Browser: Safari 5.1 (7534.48.3)
Operating System: Mac OS X (10.7)

g’day Kevin

something like this could help to do what your after


tell application "Adobe InDesign CS5.5"
	activate
	set heightIncrease to 1.764
	set myDoc to active document
	tell myDoc
		set {a, b, c, d} to bounds of page 1
		set myRectangle_1 to item 1 of selection
		set stroke weight of page item 1 to 0.25
		set stroke color of myRectangle_1 to swatch "None" of myDoc
		set {w, x, y, z} to geometric bounds of myRectangle_1
		move myRectangle_1 by {(d / 2 - (x + z) / 2), (c / 2 - (w + y) / 2 + heightIncrease)} -- move slightly
		--move myRectangle_1 by {(d / 2 - (x + z) / 2), (c / 2 - (w + y) / 2)} --centre on page
	end tell
end tell

Excellent “ thanks Budgie.

I’ve pruned it slightly, so now I have this, which works exactly as I want …

tell application "Adobe InDesign CS5.5"
	activate
	set moveDown to 1.764
	set myDoc to active document
	tell myDoc
		set {a, b, c, d} to bounds of page 1
		set myRectangle_1 to item 1 of selection
		set {w, x, y, z} to geometric bounds of myRectangle_1
		move myRectangle_1 by {0, moveDown}
	end tell
end tell

Many thanks again!

Hi. If all you want to do is move a selection, you don’t need the page bounds or the item’s geometric bounds; by is a comparison to the item’s present position.

tell application "InDesign CS"'s document 1 to move selection by {1, 2}