views:

94

answers:

3

I have a script that runs several little programs I don't have the source code to, one of which requires filling out some fields in a GUI. I've been doing this by hand, but I'd like to have the Perl script focus the GUI window, then enter some hardcoded text into each field and close the window.

+1  A: 

Unless there's a specific reason you're using Perl, Autoit is a Basic-like scripting language pretty much specifically designed for automating GUI tasks. It's very easy to pick up.

You can have it wait for a window to become active, send any sequence of keystrokes or tell it to specifically focus on a GUI element with a given handle, and much more. You can also package the scripts as standalone executables, which can be a nice benefit when you need it.

Mark Rushakoff
+1  A: 

You might want to look into Win32::OLE. There's also a book on this topic.

chaos
+5  A: 

In the past I've used the Win32::GuiTest module for tasks like this. Have a look at the example scripts and documentation.

ChrisN