If anyone's interested in doing something similar in Java or another JVM language, check out the AWT Robot[1]. It's one of those hidden gems of the Java API.<p>[1] <a href="http://download.oracle.com/javase/6/docs/api/java/awt/Robot.html" rel="nofollow">http://download.oracle.com/javase/6/docs/api/java/awt/Robot....</a>
I tend to do similar things with the games that I play, including Farmville. Once I've figured out the optimal strategy for things, I find that it's much more interesting to code it up, rather than go through the motions.<p>Some people consider it cheating, but I consider it more 'taking advantage of suboptimal game design', ie. if I can script it, it's likely not a very interesting game in the first place.
Related:<p>RoboGamer uses the same interfaces human uses (i.e. video and a joystick)
<a href="http://www.youtube.com/watch?v=2vH62EEfH6E" rel="nofollow">http://www.youtube.com/watch?v=2vH62EEfH6E</a><p>There was another project, vArashi, to achieve similar, circa 2001.<p>And probably you remember rogomatic...
Very interesting programming project. I'll have to give that a try sometime.<p>For day-to-day automation of stuff, I like to use sikuli [1] which lets you automate pretty much anything in a gui using screenshots. (Their editor is pretty cool). It's a research project so a bit rough around the edges, but still worth your time to check it out if you're at all interested in automation (auto-configuring systems, driving applications, playing flash games, etc)<p>[1] <a href="http://sikuli.csail.mit.edu/" rel="nofollow">http://sikuli.csail.mit.edu/</a>