Benji York wrote: > Terje Johan Abrahamsen wrote: > > I have been trying desperately for a while to make Python push the > > left mousebutton. > > Here's some code I've used to simulate a *right* click, but it should
> be obvious how to make it do what you want: > > void sendRightClick(void) > { > PostMessage(GetForegroundWindow(), WM_RBUTTONDOWN, MK_RBUTTON, 0); > PostMessage(GetForegroundWindow(), WM_RBUTTONUP, 0, 0); > } Thanks for the input. I have 'Pythonized' the code a little: >>> def click(): ... windll.user32.SetCursorPos(100, 100) ... win32gui.PostMessage(win32gui.GetActiveWindow(), win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, 0) ... win32gui.PostMessage(win32gui.GetActiveWindow(), win32con.WM_LBUTTONUP, 0, 0) and when I try it like this: n = click() Sure, the cursor moves, but it does not click. What am I doing wrong? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list