AutoIt fits your need but you'd need to read into the basic commands and learn a little bit of programming. There even is a AutoIt

where you can find help and answers.
There are also several mouse and macro recorders around, but they won't be able to send commands to a certain process.