I found this, Controlling mouse with Python, question really helpful in creating a script to move the mouse and click the mouse using Python. Is it possible to create a mouse scroll event also? Also, what about the forward and back button?
Just for "late" viewers, this would require you to change the 4th argument dwData...
I think it would look like this:
import win32api
from win32con import *
#Scroll one up
win32api.mouse_event(MOUSEEVENTF_WHEEL, x, y, 1, 0)
#Scroll one down
win32api.mouse_event(MOUSEEVENTF_WHEEL, x, y, -1, 0)
#Scroll one to the right
win32api.mouse_event(MOUSEEVENTF_HWHEEL, x, y, 1, 0)
#Scroll one to the left
win32api.mouse_event(MOUSEEVENTF_HWHEEL, x, y, -1, 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With