Examples of Python driven Microsoft UI Automation wanted

DuaneKaufman duane.kaufman at gmail.com
Thu Jul 9 14:09:03 EDT 2009

On Jul 9, 12:45 pm, Tim Harig <user... at ilthio.net> wrote:
> On 2009-07-09, DuaneKaufman <duane.kauf... at gmail.com> wrote:
> > On Jul 9, 12:18 pm, Tim Harig <user... at ilthio.net> wrote:
> >> On 2009-07-09, TheSeeker <duane.kauf... at gmail.com> wrote:
> >> > Specifically, I have a WinForms application I will be wanting to
> >> > automate. Does anyone have some Python examples of driving Microsoft
> >> > UI Automation they could share with me to get me started? The
> >> > structure of the UI automation classes etc. seem quite convoluted, and
> >> > I am having difficulty getting my brain wrapped around it.
> >> If you find a way to work through the UI using the keyboard (tabs, etc);
> >> then, you can send it keyboard commands using WScript.WshShell.SendKeys():
> >>http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
> > Unfortunately, I need to be able to find out the contents of a few
> > text-boxes as well,
> > so SendKeys isn't all I need.
> Then you will need some way to import your application as an object so that
> you can gain access to the methods and properties directly.  Using
> IronPython you should be able to access anyting in the GAC.  If you
> register your UI componets then you should be able to access them.  If not,
> or using cpython, you might be able to do something like:
> http://msdn.microsoft.com/en-us/library/fh1h056h(VS.71).aspx
> to get a mashalled COM object.

Thanks again Tim.

I believe I probably mis-communicated my requirements (or at least,
was not explicit enough)

The application I wish to interact with is not my own, but an ERP
system GUI front-end.

With MS utilities like UISpy and the like, I can 'see' the controls in
the application, but I
do not seem to be able to manipulate them programatically, and I
believe it us simply due
to my not understanding of the UI Automation API.

Hence, my request for example code to boot-strap myself.


More information about the Python-list mailing list