How to drive a Windows GUI? (PyNewbie)
Robin Becker
robin at jessikat.fsnet.co.uk
Fri Apr 27 15:32:02 EDT 2001
In article <mailman.988395882.14126.python-list at python.org>,
optopianet at netscape.net writes
>I'm attempting to programmatically drive an application window from Python, much
>like "macro recorder" or automated testing software.
>
>Has this been done? I haven't found anything obvious.
>
>Using win32ui, win32gui, PyCWnd and others, I can locate the application window
>(EnumWindows), maximize it (ShowWindow), and bring it to the fore
>(BringWindowToTop).
>
>At the moment, I'm stumped as to how to activate menus.
>I'd like to have the menus pop up and have each item highlighted in turn until
>the desired selection, which is then activated.
>
>Do I use spy to capture the "messages" and try to replicate the behaviour using
>SendMessage?
>Is there a better way?
>
> thanks,
> - gordon
...
many applications can be controlled from the keyboard using short cut
key combos. If you can do that with your app then perhaps you could try
and emulate something like the sendkeys statement of vba.
Certainly spy recording is possible, but there are a lot of events and
you would need to know how to force say a mouse button push to a
particular button/menu.
--
Robin Becker
More information about the Python-list
mailing list