經過實作確定可行!
python + adb command 實作andorid 手機的遊戲外掛
透過python 下adb command 截圖並pull 到電腦端
def getPic():
os.chdir(adb)
os.system("adb shell screencap -p /sdcard/screen.png")
os.system("adb pull /sdcard/screen.png "+pic_dir+"pic.png")
os.system("adb shell rm /sdcard/screen.png")
接著透過 python PIL lib 做圖形識別
接著對手機送touch event
def touch(x,y):
os.chdir(adb)
os.system("adb shell input tap "+str(x)+" "+str(y))
優點:
實作超快! 省時省力
缺點:
需要開著電腦!
沒有留言:
張貼留言