Python自动点击鼠标脚本

import time
import random
import keyboard
from pymouse import PyMouse

def keyboard_input():
    print(1)
    hotkey = keyboard.read_hotkey()
    print(hotkey)
    return 0

def move_mouse():
    time_interval = 5
    m = PyMouse()
    a = m.position()  # 获取当前坐标的位置
    b = [1,2]
    c = 0
    a = (1005.1102294921875, 533.56201171875)
    while True:
        a = tuple(a)
        m.move(a[0],a[1])  # 鼠标移动到(x,y)位置
        a = list(a)
        print(a)
        m.click(100,100)
        if (b[c]%2)==0:
            a[0] -= 20
            a[1] += 20
        else:
            a[0] += 20
            a[1] -= 20
        if (c==0):
            c = 1
        else:
            c = 0
        time.sleep(time_interval)
        print("time:",time.time())
    return 0

if __name__ == '__main__':
    move_mouse()

你可能感兴趣的:(python,python,开发语言)