Freehand MX script and simple UI

Hi
looking for some help with a script that I am putting together using FreehandMX.
The script works like this, the UI has 5 fields (in order as per script) the numbers put into these fields are different each time, for example “polwidth” could be 110mm, “pulllength” could be 100mm, “winwidth” could be 100mm, “winheight” could be 50mm, the “winwidth” and the “winheight” figures will always be smaller than the “polwidth” and “pulllength”, the “amount” is to step and repeat the item on a Y axis (not worried about that now), the result from these figures is a rectangle placed into a page centred left and right, top and bottom, a clone is made to be 2mm bigger all around the origional rectangle (leaveing the origional rectangle alone).
Problem I am having is getting the boxs to centre in the page on the X & Y axis and getting the box to then add 2mm top and bottom of the origional rectangle, keeping every thing central along tha way. At presant the only way to create a rectangle to be placed into the new doc is to draw one in a untitled doc then run the scrpit, if any one can tell me a better way, im deffintitly interested.
I am posting this issue here in the hope that some one uses freehand and xcode.

on clicked theObject
	if name of theObject is "build" then
		set filelocation to (choose file name with prompt "Save file now")
		set polwidth to contents of text field "polwidth" of window "main" as number
		set pulllength to contents of text field "pulllength" of window "main" as number
		set winwidth to contents of text field "winwidth" of window "main" as number
		set winheight to contents of text field "winheight" of window "main" as number
		set amount to contents of text field "amount" of window "main" as number
		set leftpos to (polwidth - winwidth) / 2
		set toppoS to pulllength - winheight
		-------------------------
		tell application "FreeHand MX"
			activate
			Select
			Copy
			close without saving
			make new document
			Set PageSize width polwidth height pulllength Units MM
			Paste left leftpos top toppoS Units MM
			save in filelocation
			Select
			Clone Selection
			set sizeX to winwidth + 4
			set sizeY to winheight - 4
			Scale XScale sizeX YScale sizeY Search Selection
			----------------------------------
		end tell
	end if
end clicked

Budgie :?: 

I use FH MX for quite a bit at work and have found that creating templates helps out alot.

For instance, we have different layouts that can be chosen for some of the simply typesetting we do - could be two lines of copy and a design either stacked, or linear. Rather than try to import or paste everything dynamically, I set up a bunch of art pages and saved them as templates.

To align items in FH MX, you are still forced to use Sytem Events to invoke keyboard commands as Macromedia has invested zero effort in improving FH’s dictionary. So, if you have a template with three items you want to design vertically - look up the keyboard shortcut for align vertical. Actually, I found that FreeHand’s defaults for the align shortcuts didn’t work so well via applescript as they contain numbers so I made my own. And, if you are going to align things on a page, you can select them by their name, their type, or invoke “select all on page” with command - a.

I also find it really helps to surround each command to FH with “update” as FH will skip commands without telling you.

Hope this helps - if you need more help, post again.

Gidday
Cheers for taking the time out to help.
I to use Freehand for quite a bit of work, and have literally a couple of hundred templates for the various task that I perform.
This particular project is not really revolveing around a template more of, one of style designs, for a specific part of a printing process, the idea is to build these objects by just typeing in numbers, as described, sounds like Freehand may not be my choice, was having a nosey around in InDesign, seems this may have a better dictionary to work with,. you wouldnt no where I can lay my hands on some script similar to what im after?

Budgie

Have either of you had problems using the Application Suite’s SELECT command because FH interpreted it as its own SELECT (for graphics objects)?

I jumped on this thread because I’ve had endless trouble trying to find documentation or even other users when it comes to FH and Applescript or UI.

Hi
I havent had issues with “select”, with the process tha I am building I am creating a new doc, making a box say 100 x100mm then I run my script, the script selects from the doc and ten closes it and pastes that item into a new doc and builds the rest of what I want from thier.
I might be misunderstanding what your asking, but generally no probs.

Budgie