autojs 按下状态_Autojs教程:巧用点击函数

视频里的函数分享在这里,有需要自取哦

//控件点击

function 控件点击(dshuxing, dzhi, dname) {

var a = dshuxing(dzhi).boundsInside(0, 0, device.width, device.height).findOnce();

if (a != null) {

var x1 = a.bounds().left;

var x2 = a.bounds().right;

var y1 = a.bounds().top;

var y2 = a.bounds().bottom;

var x = random(Math.floor(x1 + 1), Math.floor(x2 - 1));//删除控件四周1的边界,防止边框位置点击无效

var y = random(Math.floor(y1 + 1), Math.floor(y2 - 1));

var timedelay = random(50, 150);

toastLog("点击 [" + dname + "]");

press(x, y, timedelay);

sleep(1000);

return true;

} else {

toastLog("无法找到 [" + dname + "]");

//其他内容

}

}

你可能感兴趣的:(autojs,按下状态)