[python-win32] Fwd: Re: [Python-Help] Python script to click
Jens B. Jorgensen
Fri, 13 Dec 2002 22:03:40 -0600
This can certainly be done. You need to know the id of the button you
need to send the message to and then you can call the win32 SendMessage
call to deliver the click message or perhaps just ID_OK. At any rate the
tougher part is finding the right window on the screen to send the
message to. This isn't too hard to since you can probably figure out
which window is by its text property. You'll definitely want the
win32all extensions (or just install ActiveState's distribution which
includes this). You can start from the root window and enumerate all the
windows on the screen to find the right one. It helps to have an
understanding of how the win32 api calls work. I can help further, but I
don't have the code handy that enumerates through the windows but I have
done something just like this. Start looking at the win32 api calls.
Post back here and tell us how far you've gotten and we'll help you get
> I'm hoping someone on the Win32 list can help me out. See below for
> details and an initial result.
>> From: Matthew Dixon Cowles <email@example.com>
>> To: jtownsen <firstname.lastname@example.org>
>> Cc: email@example.com
>> Reply-To: firstname.lastname@example.org
>> Subject: Re: [Python-Help] Python script to click OK
>> Date: Thu, 12 Dec 2002 19:54:01 -0600 (CST)
>> > First off, I'm fairly new to Python but have been using Perl for
>> > some time.
>> Welcome to Python!
>> > I'd like to have a Python script click a Windows' OK button. I'd
>> > appreciate any suggestions.
>> I'm sorry but I'm not much of a Windows guy and I don't know how to
>> do that. If someone else here knows better than I do, I'm sure that
>> they'll jump in and tell us both.
>> There's probably something in Mark Hammond's win32all extensions that
>> will do it. They're at:
>> but I don't know just what. The folks on the python-win32 list
>> probably know the details. There's more information about that list
>> I wish I had a better answer for you.
> Python-win32 mailing list
Jens B. Jorgensen
"With a focused commitment to our clients and our people, we deliver value through customized technology solutions"