Skip to content Skip to sidebar Skip to footer

How To Emulate Mouse/keyboard Events In A Unfocused/minimized Window?

I am trying to do some automation with Python, but I want to execute it and still being able to use my machine freely. So I am using PyWin32 to emulate some clicks and typing but i

Solution 1:

i do not know the PyWin32 package but from a win32 api point of view the thing should be easy. get a HWND of that window and post (PostMessage) the events you want to the window.

eg: WM_LBUTTONDOWN & WM_LBUTTONUP, WM_RBUTTONDOWN & WM_RBUTTONUP, WM_MOUSEMOVE...

look at the win32 help how to set the wParam & lParam data for the specific events.

i controlled diablo 3 this way for example ;)

Edit: there is no need to be in focus or maximized for this

Edit Edit: may be you should look after autoit, a widely used scrip language for window automation. I never used it but read the name very often in this context. it may also be usable from python.

Post a Comment for "How To Emulate Mouse/keyboard Events In A Unfocused/minimized Window?"