Scale frame in Indesign CS5.5

Can anyone tell me how to script an increase in a frame’s height?

I know I need to use a transformation matrix and work with the frame’s geometric bounds, but I can’t find any references to specific value increases - i.e. increase height by 2mm for example - only references to scale factors (.5, 50% etc), just plenty of info on skew and rotate etc.

I wish to create a small script that will increase the height of a selected frame by a set amount.

Here’s a snippet that I know won’t work, but that sort of shows what I’m after …

		set theFrame to selection
		set theBounds to geometric bounds of selection
		set topPosition to item 1 of theBounds
		set leftPosition to item 2 of theBounds
		set bottomPosition to item 3 of theBounds
		set rightPosition to item 4 of theBounds
		set newHeight to ((item 3 of theBounds) + 2.117)
		set geometric bounds of theFrame to {topPosition, leftPosition, newHeight, rightPosition}

How should I go about creating the transformation matrix to specify a set mm increase in height?

Model: MacPro Qaud Xeon
AppleScript: 2.4
Browser: Safari 5.1 (7534.48.3)
Operating System: Other

If your goal is to just increase the height of the frame then use the geometric bounds:

tell application "Adobe InDesign CS4"
	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) + 2, (item 4 of theBounds)}
end tell

Assuming that your document view preferences are set to millimeters the above will add 2 millimeters to the height of the selected frame. I have this set to just work with the first frame if there are multiples selected, a simple loop on a selection should make it work with all of them selected. To eliminate the potential for math errors you might want to add in a routine that sets the view preferences. I think there is a way to coerce between measurements but I forget how to do it since I typically set them to points at the beginning of a script and reset them at the end of the script.

Thanks Jerome … that’s perfect. I didn’t think it would be so simple, and that I’d have to setup a matrix first etc.

I take your point about ensuring the document view preferences are set correctly, so I shall work that in to the script too.

Again, many thanks.

hi kev
try this for setting measurements

tell application "Adobe InDesign CS5"
	tell active document
		--picas, points, inches, inches decimal, millimeters, centimeters, or ciceros
		set properties of view preferences to {ruler origin:page origin, horizontal measurement units:millimeters, show frame edges:true, show rulers:true, vertical measurement units:millimeters}
	end tell
end tell