Drawing a line in InDesign CS2

As I stumble through learning AppleScript, I wonder if anyone can provide me with some example code.

I’m looking to script the following behavior:

  1. Get current width of selected object(s) in InDesign (could be just a text box or a text box next to a photo frame).
  2. Use that width to draw a 2pt black line 10pts above the selected object(s).

Seems simple, but painful for a newbie. Thanks for any advice.

this should get you most of the way there

tell application "Adobe InDesign CS2"
	tell active document
		set {t, l, b, r} to geometric bounds of text frame 1
		tell page 1
			make new graphic line with properties {geometric bounds:{(t - 10), l, (t - 10), r}, stroke weight:2}
		end tell
	end tell
end tell