1 Star 2 Fork 3

刘凯/My RPA

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
lkRPA.py 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
刘凯 提交于 2021-11-27 13:01 . 第一次
import pyautogui
import time
import pyperclip
def clickpng(img,t):
times = t
try:
# 1:左单击;2:左双击;3:右单击;4:无限左单击
if times == 1:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.click(location)
elif times == 2:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.doubleClick(location)
time.sleep(1)
elif times == 3:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.doubleClick(location)
elif times == 4:
while True:
location = pyautogui.locateCenterOnScreen(img, confidence=0.9)
pyautogui.click(location)
time.sleep(0.3)
else:
print('参数有误!')
except:
print("图片有问题")
if __name__ == '__main__':
key = input("请选择运行模式(1:单次运行;2.无线循环):")
print(key)
if key == '1':
print('凯牌RPA开始执行...')
time.sleep(5)
clickpng("chrome.png", 2)
clickpng('baidu.png', 1)
pyperclip.copy("国王排名")
pyautogui.hotkey("ctrl", "v")
pyautogui.hotkey("enter")
time.sleep(2)
clickpng("tupian.png", 1)
time.sleep(2)
pyautogui.screenshot('my.png')
time.sleep(1)
clickpng("quit.png",1)
print("凯牌RPA执行完毕!")
elif key == '2':
while True:
time.sleep(3)
clickpng("chrome.png", 2)
clickpng('baidu.png', 1)
pyperclip.copy("国王排名")
pyautogui.hotkey("ctrl", "v")
pyautogui.hotkey("enter")
time.sleep(2)
clickpng("tupian.png", 1)
time.sleep(2)
pyautogui.screenshot('my.png')
time.sleep(1)
clickpng("quit.png", 1)
print("凯牌RPA执行完毕!")
else:
print("请正确输入!")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liusukai/my-rpa.git
git@gitee.com:liusukai/my-rpa.git
liusukai
my-rpa
My RPA
master

搜索帮助