July 23rd, 2004, 07:55 PM
win32 python - mouse events
Ok, I'm trying to write a quick script that will send a mouse_event to the currently focused window.
Script runs --> desktop is focused --> right click event is sent.
But this doesn't seem to work.
win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 700, 700, 0)
I'm using activestate python with its win32 extentions. I understand it makes reference to c++ documentation for the win32 api/com, but I cannot find any decent examples around.
Can anyone help me out creating a "right clicker" script? Is there any way to target particular applications?
Just so you know, the event seems to work, but I believe I need to target applications. I've imorted win32api and win32con and a try clause doesn't raise any exceptions.
July 23rd, 2004, 08:21 PM
Originally Posted by twll
I managed to get it to send the mouse event to the windows desktop and various win32 apps. But it doesn't seem to send the mouse_event() to directx applications. This is ultimatly what I want to achieve.
I think I have to use win32con.setCapture() to choose the window to send the mouse_event to, but I'm not sure how to specify the window.
If anyone can explain how I use setCapture, or how I specify a window please let me know.