I'll be looking at the scripting support a bit next week, but if all else fails, exec and execAndWait are your friends. You can use javascript to manipulate the form and you can debug it locally in your dev tools to make sure it works before submitting it.