搜集到的资料,整合一下。
events.onKeyDown('home', function (event) {//按home停止
toast('程序结束')
console.hide()
threads.shutDownAll()
})
events.onKeyDown('volume_down', function (event) {//按音量下停止
toast('程序结束')
console.hide()
threads.shutDownAll()
})
可以重写sleep
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function 权限申请() {
if (!floaty.checkPermission()) {
toast('请开启悬浮窗和后台弹出界面权限');
floaty.requestPermission();
return
}
if (auto.service == null) {
toast('请开启脚本的无障碍服务');
auto.waitFor();
return
}
}
权限申请();
var url = 'http://源码所在位置'//你要运行的js云端源码
var res = http.post(url, {});
var Source = res.body.string();//变量自己随便写就行
if (Source != '') {
engines.execScript('运行脚本名字', Source);
} else {
toast('似乎出了点问题,请联系作者解决');
}
原博客https://blog.csdn.net/qq_30931547/article/details/107646409
联系客服