# -*- coding: UTF-8 -*-
import pyperclip
import pyautogui
tacklist = [
{"type": "单击图片", "centent": "img/1.png"},
{"type": "输入文字", "centent": "你好,我暂时不在,有急事麻烦请留言!"},
{"type": "单击图片", "centent": "img/sed.png"},
]
def click(img):
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
if location is None:
return False
else:
pyautogui.click(location.x, location.y, interval=0.2, duration=0.2)
return True
def dotack(tack):
if tack["type"] == "单击图片":
img = tack["centent"]
return click(img)
elif tack["type"] == "输入文字":
text = tack["centent"]
pyperclip.copy(text)
pyautogui.hotkey('ctrl', 'v')
return True
while True:
i = 0
while i < len(tacklist):
if dotack(tacklist[i]):
i += 1
else:
print('监听中!')