So my left mouse click its a bit broken. Then i had an idea to make a python script to map my mouse button to the space key on my keyboard. I just managed to implement the click but not the hold, and it is still a bit janky so i wanted help with that.
here's my script so far:
import time
import keyboard
import pyautogui
import win32api
import win32con
def LeftClick(x, y):
win32api.SetCursorPos((x, y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
while True:
if keyboard.is_pressed('space'):
print("Left mouse button pressed")
MousePos = pyautogui.position()
LeftClick(MousePos.x, MousePos.y)
time.sleep(0.1)