November 19, 2003
7 hours, one line of code

Some days, the code just flows. But not when you are calling the Windows API. :-(

I've been working a bit more on Windows GUI automation, specifically on combo boxes.

The problem was with automating the selection of items in the combo. To begin with, I was just sending a CB_SETCURSEL message to the combo, like so:

win32gui.SendMessage(hwnd, win32con.CB_SETCURSEL, item, 0)

This did the selection in the combo box so far as I could see, but it wasn't sticking - the changed selection wasn't having any effect on the rest of the dialog.

Turns out, I need also to send a CBN_SELCHANGE, too. Finding this out, along with working out how to send the bloody thing, has taken all day. Sigh.

For what it's worth, here is the final (working?) selectComboboxItem() function, and the whole winGuiAuto module. This is work in progress, mind, but you're welcome to it if it's useful to you.

Posted to Python by Simon Brunning at November 19, 2003 04:56 PM
Comments

Simon,

Excellent work on the winGuiAuto!!

I am using winGuiAuto along with my small open-source application PAMIE.

My simple application is for QA Engineers and developers testing Web Apps. PAMIE stands for Python Automation Module for Internet Explorer

With PAMIE I can only control an instant of the browser but not the dialogs.

winGuiAuto program allows me to be able to control the Alert and Download dialogs that open seperately from the browser.

I have include some example scripts on my site.
winGUiAuto seems to be getting raves!!

Thanks for the hard work!
Rob Marchetti

Posted by: Rob Marchetti on August 18, 2004 05:58 PM

Simon,

Your WinGUIAuto stuff Rocks. Having been assigned to write scripts in Python to drive GUIs on another application, and not knowing that much about Python or win32 programming, I've been stumbling around the internet for a few days looking for good examples of python stuff that allows me to interact with other windoze applications.

Your *Totally Awesome!* WinGUIAuto gave me exactly what I needed to take a glance inside (and understand) what was going on inside the win32 apis and take off from there.

Thanks for all your work and allowing the rest of us to look at it.

Tim

Posted by: T. Montoya on November 15, 2004 08:58 PM

Thanks a lot for the winGuiAuto module!

I have noticed that, using clickButton(hwnd) with a button that opens a persistent window, the function waits until the window is closed.

I have resolved the problem using, instead of clickButton(), these lines:

win32api.PostMessage(hButton, win32con.WM_LBUTTONDOWN, 0, 0)
win32api.PostMessage(hButton, win32con.WM_LBUTTONUP, 0, 0)

where hButton is the handle of the button.

Thanks again, Nicola

Posted by: Nicola Lottici on January 26, 2005 08:32 PM

That's what clickButton() *used* to look like. Perhaps both are needed - an asynchronousClickButton() function, perhaps, with your code in it.

Posted by: Simon Brunning on January 27, 2005 03:42 PM

Hello Simon,

I need to automate the installation of a program under Windows. I use python + win32 extension

But I have two problems:

1) During the installation, there is a CheckListBox (with className="ListBox") and I don't know how to check the boxes of this CheckListBox.

2) After, there is an alert-message. I must click on 'Yes' button. But the posting of this message stops the execution of my Python program. Consequently I can't find this window with FindTopWindow(). Nevertheless, if I launch another Python program, I can find this window and click on 'Yes' button

Your driving win32 works already helped me much. Do you have an idea to solve these two problems?

Thank you very much.

David (France)

Posted by: David on March 18, 2005 02:33 PM

You might want to ask this in the WATSUP users list[1], David.

[1] http://lists.sourceforge.net/lists/listinfo/watsup-users

Posted by: Simon Brunning on March 18, 2005 04:13 PM
Post a comment
Name:


Email Address:


URL:



Comments:


Remember info?