Getting to grips with the finer points

Hi All
I am trying to locate a Indesign CS2 script that will allow me to in conjunction with
AppleScript Studio build a small application.
I would appreciate getting some pointers using applescript in conjunction with Indesign,
I have tried using bits of scripts to build what i am trying
to achieve but am having limited success, any help would be appreciated.

The application will work as follows:

a) The GUI will have 5 text fields and one button “Build”, the first text field will be the page width in mm, the second
will be the page height in mm, the third will be the width of a rectangle in mm, the fourth will be the height of the
rectangle in mm, the fifth will be the amount to step and repeat the rectangle in mm.

b) What I am trying to achieve is after the page width, height and rectangle width, height and step and repeat
value is entered is to have Indesign build the page, place the rectangle, give the rectangle a corner radius of
4.6, clone the rectangle and make it 2mm bigger than the first rectangle, then again clone the first rectangle and
make it 2mm smaller than the page width and height and giving it no radius, then have the outer rectangle and second rectangle join
and get filled with a pattern, then group, and step and repeat so as the top of one image is 4mm away from the bottom
of the image above, repeat in accordance with the amount of step and repeats required, also having the page size adjust
to suit the step and repeats.

C) Heres what I have so far:

on clicked theObject
if name of theObject is “build” then
set _window to window of theObject – this is assuring the correct window
-----
set _pulllength to (contents of text field “pulllength” of _window as number)
set _polwidth to (contents of text field “polwidth” of _window as number)
-----
set _winwidth to (contents of text field “winwidth” of _window as number)
set _winheight to (contents of text field “winheight” of _window as number)
-----
tell application “Adobe InDesign CS2”
set myDocument to make document
tell document preferences of myDocument
set page height to _pulllength – this is to isolate confusion between your app and InDesign document
set page width to _polwidth – this is to isolate confusion between your app and InDesign document
set page orientation to landscape
set pages per document to 1
-----
tell application “Adobe InDesign CS2”
tell document 1
tell page 1
set w to _winwidth
set h to _winheight
set y to _pulllength
set x to _polwidth
make rectangle with properties {geometric bounds:{w, h, y, x}}
end tell
end tell
end tell
end tell
end tell
end if
end clicked

Thanks in advance
Budgie