If you really need to script it, you could always use GUI scripting. This method allows you to script any application, although it can be ugly and tedious to get it to work. Only use as a last resort.
You can find more information here : http://www.macosxautomation.com/applescript/uiscripting/index.html