如何在Windows上覆盖鼠标按下键?

时间:2019-06-30 19:26:07

标签: python windows pywin32

我正在用python对自动点击程序进行编程,当我启动它时有一个程序,它会阻止在我执行的python自动点击程序中执行的所有点击。 我不知道如何绕过它,我该怎么办?

自动答题器可以100%正常运行,我在点击速度测试中对其进行了测试,但是当我启动其他程序时,它会取消自动答题器程序中的点击,但其他所有方法都起作用,打印方法,更改变量都很好,只是禁用点击次数

该代码在python上(有点混乱-这是我朋友的代码)

import win32api, win32con
import time
import random
from pynput.mouse import Button, Controller
from pynput.keyboard import Listener, KeyCode
print("Welcome To The Best Undtected AutoClicker To Activate Preess Z And To Activate Press Mouse 3 For Toggle And Mouse 4 For While Clicked")
state_left = win32api.GetKeyState(0x06)  # Left button down = 0 or 1. Button up = -127 or -128
state_right = win32api.GetKeyState(0x5A)  # Right button down = 0 or 1. Button up = -127 or -128
clicked = False
zclicked = False
button = Button.left
mouse = Controller()
clicked1 = False


def click():
    i = random.randint(2, 15)
    i = i / 100
    mouse.click(button)
    time.sleep(i)


while True:
    a = win32api.GetKeyState(0x06)
    b = win32api.GetKeyState(0x5A)
    if a != state_left:  # Button state changed
        state_left = a
        if a < 0:
            clicked = True
        else:
            clicked = False

    if b != state_right:  # Button state changed
        state_right = b
        if b < 0:
            if (zclicked == True):
                zclicked = False
                print("Z Button Is Off")
            elif (zclicked == False):
                zclicked = True
                print("Z Button Is On")
    if (clicked == True and zclicked == True and clicked1==False):
        click()
    if zclicked == True and win32api.GetKeyState(0x05) == 1:
        clicked1 = True
    elif (win32api.GetKeyState(0x5) == -0 and zclicked == True and clicked==False):
        clicked1 = False
    if (clicked1 == True):
        click()

    time.sleep(0.001)

另一个程序在mouse.click(button)方法中禁用了代码click(),我需要以某种方式绕过它。

0 个答案:

没有答案