[python-win32] Selecting OK button in dialog

mjohnson mjohnson at mpjconsultancy.com
Thu Oct 11 11:40:12 CEST 2007


I know this has been discussed elsewhere, maybe even on this board.  But I am getting spooky things happening, can anyone shed any light please?

I enumerate through the windows until I find the one I want, then using 

childWindows = []
win32gui.EnumChildWindows(window[0], windowEnumerationHandler, childWindows)
for child in childWindows:
         if child[1]=='OK':
                  print child
                  win32gui.SendMessage(child[0], win32con.WM_LBUTTONDOWN, 0, 0)
                  win32gui.SendMessage(child[0], win32con.WM_LBUTTONUP, 0, 0)

I click the OK button.

If I watch the execution on the screen I can see the OK button depressed then released, but nothing happens.  The spooky part is that if I then move the mouse over the dialog with the OK button then the action is performed.

I guess there is something else needed, perhaps focus.

All hints and tips gratefully received, thanks
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20071011/52da0f45/attachment.htm 


More information about the python-win32 mailing list