[python-win32] Post Message

Tim Roberts timr at probo.com
Mon Dec 15 19:03:17 CET 2008


Ferdinand Sousa wrote:
>
> I have written a small script to automate a process. The issue is that
> a "Save As" pops up at the end. Using Winspector, I could come up with
> this:
> win32gui.PostMessage(win_hdl,con.WM_COMMAND,1,0) # handle to the "Save
> As" window, message type, Control ID of the "Save"
> button
>  This works perfectly. However, now I would like to modify the "File
> name" field so that I can change the default save location. It is a
> combo box and has a control ID 1148. Using intuition, I tried
> WM_SETTEXT, but no luck. Any pointers?
> If possible, could any one point out any general, simple-to-use help
> on the PostMessage function?

What process are you automating?  Many big applications today can be
controlled by COM, which is a much more reliable and predictable method
of control than hacking window messages.

Remember that the "Save As" dialog is in a separate top-level window,
and because it is modal, it has its own message loop.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list