function main() --獲取屏幕的分辨率 w,h = getScreenResolution(); --顯示屏幕長、寬 notifyMessage(string.format("%d,%d\n",w,h)); mSleep(500); -- 點擊函數 appRun("com.tencent.xin"); mSleep(500) --指定截圖保存路徑 snapshotRegion("var/mobile/Applications/back.bmp",3,65,100,110); mSleep(500); notifyMessage("沒有找到"); end
針對上次截圖,實現找圖功能:php
image_x,image_y = findImageInRegion("var/mobile/Applications/back.bmp",3,65,100,110); mSleep(500); if image_x ~= -1 and image_y ~= -1 then notifyMessage("找到圖"); else notifyMessage("沒有找到圖"); end;
其餘截圖和找圖能夠利用相似的方法作到app
不積跬步無以致千里函數