Hello Everyone,

i would like to make a file in which i move the mouse to coordinates x and y and click the scroll button(middle button). this is what i want but works for left and right i have on idea how to make it work with scroll/medium button. any help will be much appreciated. thanks

from ctypes import *
import win32api
import win32con

user = windll.user32
x = 1020
y= 390
user.SetCursorPos(x,y)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)

In linux, I do it this way

from pymouse import PyMouse
m = PyMouse()
m.click(1020, 390, 1) # it works !

The module pymouse can be found here http://github.com/pepijndevos/PyMouse . It claims to be cross platform, so you should try it in windows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.