[Tutor] 200 dollar questions!

Alan Gauld alan.gauld at btinternet.com
Sun Jul 1 01:14:49 CEST 2007


"elis aeris" <hunter92383 at gmail.com> wrote

> I am using pywin32, for python 2.5 on windows xp.
> What I want to do is these:
>
> handle = Gethandle ("window_name")

Try FindWindow(), it returns a handle given a class/window title

> "window_name"   =  "123.txt"  with notepad, for example.

That looks like the title to me...

> it should return a list if there are more than one with the same 
> name.

Nope, it only returns one, but enumWindows will give you a list
(or more accurately will yield a list if called repeatedly)

> GainFocus(handle)

I think you need SetFocus() here

> Keyboard_event ( "hello python!")
> Mouse_event (x,y, left, 2)

> the (x,y) = should be relative to the active window and independent 
> of the
> window's position. 2 as in clicking twice.

Googling on MSDN gave this pagfe which describes how it works.

http://msdn2.microsoft.com/en-us/library/ms646260.aspx


> Last,  maximize, minimize, resize, move, kill,
>
> above(handle)

These can be done using PostMessage (not sure whether you mean
Last is a command or "lastly" you want to do these things)

Read the documentation and try it out. See what happens, if you can't
get it to work come back to us with specific questions and sample
code, plus any error messages you might get.

Alan G. 




More information about the Tutor mailing list