12
2022
08

搜尋圖片及點撃。

requestScreenCapture();    //request capture authorization

sleep(1000);
captureScreen("/sdcard/at/c.jpg");   //save captured photo
sleep(1000);
toastLog("Complete");
//read photo
var src = images.read("/sdcard/at/c.jpg");
//cutting photo   //images.clip(img, x, y, w, h)
var clip = images.clip(src, 182, 274, 100, 100);
//save photo
images.save(clip, "/sdcard/at/small.jpg");
requestScreenCapture();
sleep(1000);
//read photo
var img_small = images.read("/sdcard/at/small.jpg");
//find in large photo
//images.findImage(large photo, small photo) <------return coordination(Point) or return null.
var p = findImage(captureScreen(), img_small);
if (p) {
    toastLog("Found,located at:" + p.x + "----" + p.y);
    click(p.x, p.y); //click coordination
} else {
    toastLog("Cannot be found!");

}


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。