/*
软件作者:https://xuhss.com/oxox/pro
*/
var arr = engines.all(),
me = engines.myEngine(),
stop = false;
for (let i = 0; i < arr.length; i++) {
if (arr[i].getSource().toString() == me.getSource().toString()) {
if (arr[i] != me) {
arr[i].forceStop();
stop = true;
}
}
}
if (stop) {
exit();
}
auto.waitFor();
events.observeKey();
var max = device.getMusicMaxVolume(),
toa = toasts();
events.setKeyInterceptionEnabled("volume_down", true);
events.setKeyInterceptionEnabled("volume_up", true);
events.onKeyUp("volume_down", (e) => {
var time = e.getEventTime() - e.getDownTime();
switch (true) {
case time > 300:
let path = "/sdcard/Pictures/ScreenShots/" + new Date().toLocaleString() + ".png";
let chengxu = "requestScreenCapture();\n captureScreen(\"" + path + "\");";
engines.execScript("截屏", chengxu);
sleep(1000);
if (files.exists(path)) {
toa("已截屏保存", 2500);
} else {
toa("截屏失败", 3000);
}
break;
default:
let v = device.getMusicVolume();
if (v > 0) {
v--;
device.setMusicVolume(v);
}
toa("媒体音量 " + v + "\n最大音量 " + max);
}
});
events.onKeyUp("volume_up", (e) => {
var time = e.getEventTime() - e.getDownTime();
switch (true) {
case time > 300:
threads.start(function() {
recent();
});
break;
default:
let v = device.getMusicVolume();
if (v < max) {
v++;
device.setMusicVolume(v);
}
toa("媒体音量 " + v + "\n最大音量 " + max);
}
});
//双击多任务键切换应用
function recent() {
sleep(100);
recents();
sleep(300);
recents();
}
function toasts() { //mes 是输入的通知内容,time是通知持续时间,单位是 毫秒(默认值是5秒,所以这个参数可以省略)
var th = "", //备用变量
Y = device.width / 2,
X = Y / 2,
x = Y;
var flo = floaty.rawWindow( //新建一个悬浮窗
<frame gravity="center">
<text id="message" bg="#66000000" textColor="#ffffff" textSize="2mm" gravity="center" w="*" padding="1"/>
</frame>
);
flo.setTouchable(false);
return doflo; //返回一个函数,之后的操作都在这个函数中进行。
function doflo(mes, time) {
time = time || 5000;
mes = mes || "";
if (th != "") {
th.interrupt(); //停止这个线程
th = "";
}
ui.run(function() { //在ui线程中对悬浮窗进行操作
flo.message.setText(mes); //设置文本
});
flo.setPosition(X, Y); //设置悬浮窗的位置
flo.setSize(x, -2); //设置悬浮窗大小
th = threads.start(function() { //新建一个线程
sleep(time); //等待time毫秒
flo.setSize(0, 0); //设置悬浮窗大小为0,0
th = "";
});
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
AutoJs源码-音量键功能修改
共1个文件
js:1个
需积分: 9 1 下载量 53 浏览量
2022-11-16
21:39:56
上传
评论
收藏 1KB 7Z 举报
温馨提示
AutoJs源码-音量键功能修改。本资源购买前提醒:本源码都是实际autojs项目模板,安装好autojs直接运行即可打开。1、支持低版本autojs。2、资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!。3、安装过程详见具体资源,不会使用autojs谨慎下载
资源推荐
资源详情
资源评论
收起资源包目录
AutoJs源码-音量键功能修改.7z (1个子文件)
AutoJs源码-音量键功能修改.js 3KB
共 1 条
- 1
资源评论
[虚幻私塾】
- 粉丝: 334
- 资源: 1559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功