I've been meaning to put together a series of articles on how to build a system to support software automation (where automation is not supported natively) after completing what I would say is my most significant project of my career a few months ago (it was indeed, quite awesome to see in action.
What's the motivation for this? There are somethings that you simply cannot do via APIs that require automation of the UI. For example, what if you want to write an engine that will browse a site list and grab screenshots of the pages? What if you need to generate content on the server in Excel, Word, or PowerPoint (pre-2007)? What if you need to adjust and auto-publish a large number of project plans in Microsoft Project Professional?
These types of actions require an automation engine and a supporting framework to allow for manipulation of the UI and some clever tricks to take care of the exceptional cases since they were written to be used in interactive sessions. While I obviously cannot release any of the code I wrote previously line for line, I would like to discuss the strategies and some code snippets and use new code to cover this topic which I found to be lacking when I myself was searching for a way to do this.
As a summary, I think I'm going to break it down into a few chapters:
- An Introduction: Automating Internet Explorer. As an example, we'll start by looking at the foundation of automating any of the Windows applications using .Net. The ideas here apply not only to IE, but to almost any Windows application that exposes an API.
- Simulating User Input. We'll continue the example by examining how to deal with cases where the application is expecting user input. If so inclined, we could disregard the API completely and simply use this methodology throughout.
- UI Mapped Input Sequences. We'll discuss how to take the example a bit further by examining how to trap UI elements and send the proper key sequences to handle them.
I think this will be a great series (once I actually get around to putting it together) as it will cover a whole host of technologies from Spring.Net to log4net to Enterprise Library.