The freeware AutoIT tool is an amazing piece of software which allows you to script mouse and keyboard actions. It is discussed in the "Setup Automation" section.
It doesn't work so well with broswer (IE) windows but you can confirm success of actions by looking at pixel color or waiting on windows. By default it is not very friendly so you may want to develop a reusable library of functions to nicely handle timeouts etc.
Complex scripts can be written and they can be compiled into standalone EXE programs.
I only recommend this approach if all other approaches have failed but when you need it, you need it!
There is a script recorder which can follow your actions, although to make a robust script you'd want to tweak it a fair bit. There is also a program called "AU3INFO.EXE" (no shortcut installed) which is very useful for determining mouse positions, visible text and pixel color etc.
This is a free add on (or bundled with) the "SciTE" editor and bundles "record" tools to make the development of a script a lot easier. It is available from "http://www.autoitscript.com/autoit3/scite/".
There is also a useful menu option to the recorder and "AU3INFO.EXE" tools. The editor has AutoIT undo capability, syntax highlighting, command completion plus more and is not too bad.