Automating applications with AutoIt
Lately I’ve been experimenting with Cyberlink MediaShow Espresso, a simple video conversion utility that happens to support both CUDA and ATI Stream extensions. The idea was to compare performance across various Nvidia and ATI GPUs, but I quickly discovered a problem: MediaShow isn’t scriptable. To use it, you need to be there to click the right buttons at the right times. That’s not exactly an efficient approach for a test like this, and it invites human error.
Happily, a brief web search turned up the perfect solution: a free automation system named AutoIt. Using a BASIC-like scripting language, you can direct AutoIt to generate the necessary keypresses and mouse movements to automatically control any Windows application or feature.
It’s not limited to dumbly repeating a predefined series of actions, either. Scripts can monitor what’s happening on the desktop, and then sleep, branch, loop or manipulate windows and files in response. A generous library of example scripts and functions, along with contextual keyword help and a syntax-highlighting editor, makes it easy to implement some quite sophisticated logic. If you can explain to a friend how to use an application, you can use AutoIt to script it.
The package has a few bonus tricks too – you can compile AutoIt scripts to standalone executables, and even create GUIs for them. It’s such a powerful tool that I was surprised not to have heard of it before, especially since it’s been knocking around, through various versions, for more than a decade. But I suppose this kind of automation is a niche interest: writing scripts isn’t exactly fashionable, and while AutoIt’s active it effectively takes over your desktop, so it’s not exactly a time-saver.
All the same, I’m sure many of us have established a few repetitive desktop routines – for example, you might regularly open a group of applications and arrange their windows in a particular way, or perhaps you have a troublesome tool that requires you to click through multiple requesters every time it launches. Knock up a simple script and AutoIt can do the legwork for you.
Update: Thanks to those of you who have suggested AutoHotKey as an alternative. I confess, that’s a package I really ought to have known about, not least because it regularly features in the “Essential Programming” section of the PC Pro cover disc! Now it’s been brought to my attention I’ll be sure to check it out. And of course, any other comments or suggestions are very welcome…