autojs怎么上滑屏幕

刚刚用autojs很多方面不懂,求分享一下看小视频可以自动上滑屏幕

首先设定屏幕的宽和高

var height = device.height; //设定高度值=设备高度
var width = device.width; //设定宽度值=设备宽度
setScreenMetrics(width, height); //设置脚本坐标点击所适合的屏幕宽高。如果脚本运行时,屏幕宽度不一致会自动放缩坐标。
然后下面的代码是上划
swipe(width / 2, height - 500, width / 2, 0, 500);
语句解析:
swipe(起点横坐标,起点纵坐标,终点横坐标,终点纵坐标,使用时间)
代码解析:
width / 2是宽度二分之一处。也就是屏幕宽度的中间位置。
height - 500是高度减500像素,屏幕顶部为0。
0是屏幕顶端。
500是手指从起点移动到终点所需时间,单位是毫秒。
这样讲,应该很明白了。
如果需要下滑,那么将起点坐标设置到屏幕下方,终点坐标设置到屏幕顶端即可。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2019-08-19
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html > <style> #test_f{ position:relative; width:250px; margin:0 auto; } } #test{ width:250px; top:250px; position:absolute; background:blue; } </style> <script> function show(){ if(document.getElementById("test").style.display=='none') { document.getElementById("test").style.display=""; document.getElementById("btn").value="点击隐藏"; }else{ document.getElementById("test").style.display="none"; document.getElementById("btn").value="点击显示"; } } </script> <body > <input type="button" onclick="show()" value="点击显示" id="btn" /> <div id="test_f" > <div id="test" style="display:none;"> 我在中间 </div> <div> </body> </html>本回答被网友采纳
第2个回答  2020-04-20
"auto";
while (true) {
swipe(device.width / 2, 800, device.width / 2, 500, 2000);
swipe(device.width / 2, 500, device.width / 2, 800, 2000);
sleep(2000)
}

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网