/*
软件作者:https://xuhss.com/oxox/pro
*/
importPackage(android.speech.tts);
importClass(java.util.Locale);
auto();
var tts = new TextToSpeech(context, function (status) {
if (status != tts.SUCCESS) {
toast("初始化TTS识别: " + status);
exit();
}
var r = tts.setLanguage(Locale.CHINA);
if (r < 0) {
toast("不支持该语言: " + r);
exit();
}
toast("TTS初始化成功");
});
tts.setOnUtteranceProgressListener(new UtteranceProgressListener({
onDone: function (id) {
}
}));
function textToQQVoice(text) {
sleep(1000);
speak(text);
voiceConverting = false;
}
function speak(text) {
// tts.speak(text, tts.QUEUE_ADD, null);
tts.speak(text, tts.QUEUE_FLUSH, null);
}
events.on("exit", function () {
if (tts) {
tts.shutdown();
tts = null;
}
});
var window = floaty.window(
<frame>
<linear>
<button id="action" text="QQ红包语音红包" w="auto" h="40" color="#ffffff" bg="#66000000" />
</linear>
</frame>
);
var voiceConverting = null;
//记录按键被按下时的触摸坐标
var x = 0, y = 0;
//记录按键被按下时的悬浮窗位置
var windowX, windowY;
//记录按键被按下的时间以便判断长按等动作
var downTime;
window.action.setOnTouchListener(function (view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
x = event.getRawX();
y = event.getRawY();
windowX = window.getX();
windowY = window.getY();
downTime = new Date().getTime();
return true;
case event.ACTION_MOVE:
//移动手指时调整悬浮窗位置
window.setPosition(windowX + (event.getRawX() - x),
windowY + (event.getRawY() - y));
//如果按下的时间超过1.5秒判断为长按,退出脚本
if (new Date().getTime() - downTime > 1500) {
exit();
}
return true;
case event.ACTION_UP:
//手指弹起时如果偏移很小则判断为点击
if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
onClick();
}
return true;
}
return true;
});
var thread = threads.currentThread();
function onClick() {
thread.setTimeout(qqMessageToVoice, 0);
log("onClick");
}
function qqMessageToVoice() {
if (currentActivity() == "com.tencent.mobileqq.activity.SplashActivity") {
if (text("QQ语音口令红包").exists()) {
var id = text("QQ语音口令红包").findOne();
id.parent().click();
sleep(500);
}
} else if (currentActivity() == "com.tencent.mobileqq.activity.PublicTransFragmentActivity") {
} else {
alert("请打开QQ聊天窗口");
return;
}
if (voiceConverting) {
return;
}
voiceConverting = true;
if (textEndsWith("口令红包").exists()) {
var id = textEndsWith("口令红包").findOne();
text1 = id.parent().parent().child(2).text();
log(text1)
textToQQVoice(text1);
}
}
setInterval(() => { }, 1000);
AutoJs源码-QQ语音红包
需积分: 7 9 浏览量
2022-11-15
04:15:23
上传
评论
收藏 1KB 7Z 举报
[虚幻私塾】
- 粉丝: 335
- 资源: 1559
最新资源
- FPGA读写 AD9708+ AD9280 ADDA实验Verilog逻辑源码Quartus工程文件+文档说明+硬件参考原理图
- 基于CH340C设计USB转TLL串口通信模块PADS 9.5设计硬件(原理图+PCB)文件.zip
- 信号与系统大作业-图像处理 实现了直接滤波法维纳滤波法最小二乘滤波法LR递归法matlab源码.zip
- php-leetcode题解之最小栈.zip
- php-leetcode题解之最长不含重复字符的子字符串.zip
- php-leetcode题解之最长公共前缀.zip
- php-leetcode题解之最小差值.zip
- php-leetcode题解之最小基因变化.zip
- php-leetcode题解之最小路径和.zip
- php-leetcode题解之最大正方形.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈