views:

317

answers:

3

I am interested in writing a script that can automatically operate a program in Windows XP. I figure that I can use something like AutoHotkey to do the clicking. The obstacle I am encountering is that I need the script to be able to interpret information from the GUI interface of the program. There are only a few possible things that the program can display that the script will need to be able to understand. I am thinking that I can take screenshots of the GUI in these states and save them as images. The script can then take a screenshot when it needs to interpret something from the GUI and compare the corresponding part of the screenshot to the set of images that I have saved to determine which event has occured and what it needs to do next. Is this idea feasible with AutoHotkey? Is there a better tool to use for this?

+2  A: 

If the application uses the proper Windows dialog box API, you should be able to pull the data straight from the dialog boxes and interpret it that way. A little known fact is that dialog boxes such as error messages that pop up using the Windows dialog API can be fully copied and pasted into the clipboard for diagnostic purposes. What kind of languages are you comfortable programming in?

phuzion
I use Python and Objective-C for most of my work. This is the first tool that I am targeting to Windows. The application does not uses dialog boxes for the information that I am interested in. The thing I am trying to get is an image that appears when certain events occur.
hekevintran
+2  A: 

pyWinAuto is an open source tool that does the basics of what you are looking for, and it uses Python, so no new language to learn for you.

Tom E
+1  A: 

Microsoft has a UI Automation API available in XP that allows controlling the UI from code, and getting callbacks about UI events.

Dour High Arch