电脑当机pyautogui脚本

时间:2019-02-09 19:41:00

标签: python pyautogui

我一直在用pycharm中的pyautogui做一些事情,并且我的计算机始终崩溃于下面的代码。代码运行+ -8分钟后,计算机发出几声哔哔声,并且我的鼠标开始非常奇怪地移动。因此需要重置:/。这是一个非常需要大量点击的脚本,但是我不明白为什么我无法正常运行它。

import pyautogui,time, datetime, random
from PIL import Image

y = 0
take = Image.open("take.png")
print(take.getpixel((3,11)))


while y == 0:

    wut1 = pyautogui.pixelMatchesColor(150,45, (215,127,58), tolerance=50)
    wut2 = pyautogui.pixelMatchesColor(151, 45,(215, 127, 58), tolerance=50)
    wut3 = pyautogui.pixelMatchesColor(152, 45,(215, 127, 58), tolerance=50)
    wut4 = pyautogui.pixelMatchesColor(153, 45,(215, 127, 58), tolerance=50)
    wut5 = pyautogui.pixelMatchesColor(154, 45,(215, 127, 58), tolerance=50)

    if wut1 == True or wut2 == True or wut3 == True or wut4 == True or wut5 == True:
        click_time = random.uniform(0.1,0.4)
        pyautogui.click(None,None,1,click_time)

0 个答案:

没有答案
相关问题