使用pyautogui创建脚本
pip install pyautogui
授予终端或其他运行程序以屏幕控制权限
PyClick.py
import pyautogui
import time
#按钮坐标:Mac可通过command+shift+4屏幕截图功能查看
b1 = (25,11)
b2 = (38,38)
#流程:将各按钮坐标写入pipe中
pipe = [b1,b2]
#请授予运行程序以屏幕控制权限
#——————————————————————————
#点击
def click(btn,sep):
pyautogui.moveTo(btn)
pyautogui.click()
time.sleep(sep)
def exce(pipe,num=1,sep=0.3):
print('pipe executing:', pipe)
for i in range(num):
for btn in pipe:
click(btn,sep)
#——————————————————————————
exce(pipe,2,0.3) #执行pipe,2次,停顿0.3秒
标签:脚本,pyautogui,sep,pipe,Mac,自动化,btn,click
From: https://www.cnblogs.com/yagami-light/p/18117452