上代码
from PIL import Image
import os
def getPngPix(x,y):
pngPath = r"D:\adb\screen.png"
pixelX = x
pixelY = y
img_src = Image.open(pngPath)
img_src = img_src.convert('RGB')
str_strlist = img_src.load()
data = str_strlist[pixelX, pixelY]
img_src.close()
return data
while True:
os.system(r"D:\adb\adb.exe shell screencap /sdcard/screen.png")
os.system(r"D:\adb\adb.exe pull /sdcard/screen.png D:\adb")
if getPngPix(480,2154) == (250, 157, 59): #扫描红包颜色
os.system(r"D:\adb\adb.exe shell input tap 580 2041") #点击红包
os.system(r"D:\adb\adb.exe shell screencap /sdcard/screen.png")
os.system(r"D:\adb\adb.exe pull /sdcard/screen.png D:\adb")
os.system(r"D:\adb\adb.exe shell input tap 557 1489") #点击开红包按钮
while True:
os.system(r"D:\adb\adb.exe shell screen