views:

60

answers:

3

Earlier I asked a question about command-line parameters to automate processing of a file in InfoPath. I'll probably get the Tumbleweed badge for that one.

Instead of attempting a batch solution through the command line, can someone suggest a good resource for developing a solution that will open an application and then perform actions through the application's user interface like opening a file, printing it, and closing the file?

I've seen a legacy application do this in the past where it would open Attachmate and perform I/O operations through Attachmate's interface - but I never saw the code.

One constraint is that the process will be initiated from an existing .NET solution (i.e. processing 10,000 files). I am also unable to rely on traditional Office macros like those found in Excel - InfoPath does not appear to support them.

A: 

Attachmate has a scripting language, an API and all kinds of other stuff to help with automating it. So this may not have been a typical application.

On the other hand, Attachmate products are (IMO) horrible to the extreme and I will go to great lengths to avoid working with them in the first place.

Carl Smotricz
+3  A: 

One option for automating a GUI based application is to use AutoIT. It will allow you to script the actions that are necessary for clicking menu interfaces, working with dialogs, etc.

Depending on your needs, you can create an AutoIT script on your dev machine, compile it to a standard EXE, and deploy it with the .NET project's compiled artifacts. To pass data to it, either you have your AutoIT script take command line parameters, or you have the .NET solution write a to a file with all the input file parameters and have the AutoIT script read in the file to process it. Based on the number you have in the question, I'd go with the option of writing to a file.

Agent_9191
AutoIT, formerly known as AutoHotKey (right?) is a nice solution, +1!
Carl Smotricz
@Carl: AutoIT and AutoHotKey are 2 completely different products that can tackle similar things. AutoIT is designed more for complete automation of an application without the user having to do anything (or creating a complete application in it). AutoHotKey is designed more user-initiated automation via keyboard shortcuts.
Agent_9191
I'm checking out this solution now - seems very promising.
Mayo
The other answers seem valid as well but I got this one working in minimal time - thanks for the information Agent!
Mayo
@Agent_9191: According to Wikipedia, AutoHotKey is a 2006 fork of AutoIT, so I'd expect them to be fairly similar. But thanks for the clarification, learn something new every day here on SO :)
Carl Smotricz
+1  A: 

Since you are already on .NET you might want to give the new UI Automation framework a try. I haven't tried it yet, but it is supposed to work with WPF and native Win32 applications.

MSDN also has some samples: UI Automation Control Pattern Samples

0xA3