AIGameAIGame
首页
API文档
UI框架
API实例
UI实例
下载软件
首页
API文档
UI框架
API实例
UI实例
下载软件
  • API文档

    • $global - 全局函数
    • $act - 手势动作
      • 01.手势动作 - $act
      • 02.节点选择器 - UiSelector
    • $ag - 图色框架
    • $app - 应用操作
    • $arc - 悬浮菜单按钮
      • 01.悬浮菜单 - $arc
      • 02.悬浮容器 - MenuBody
      • 03.菜单按钮 - MenuItem
    • $bus - 消息总线
    • $color - 颜色操作
    • $crypt - 加密算法
    • $device - 设备信息
    • $dex - dex,jar,so文件加载
    • $draw - 全局绘制
    • $engine - 脚本引擎
      • 01.任务信息 - JsTaskInfo
      • 02.脚本对象 - $task
    • $fc - 文件选择器
    • $file - 文件操作
    • $floaty - 悬浮窗
    • $img - 图片操作
    • $log - 日志框架
    • $ocr - 文字识别
    • $res - 资源管理器
      • 01.资源管理器 - $res
      • 02.资源操作 - ResManager
    • $root - ROOT与Shell命令
    • $screen - 屏幕操作
    • $storage - 应用内存储
    • $str - 字符串工具类
    • $sys - 系统操作
    • $thread - 并发编程
    • $tip - 对话框
    • $tts - 文字阅读

$root 返回

ROOT与Shell工具

hasPermit()

版本:1.0.0 是否获得ROOT权限

  • 返回 : {boolean} 是否获得ROOT权限
let has = $root.hasPermit();

alert("是否有root权限", has);

getPermit()

版本:1.0.0 获得root权限

  • 返回 : {boolean} 是否获得root权限
$root.getPermit();

click(x,y)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 点击位置x
  • 参数 : y {int} 点击位置y
//点击手势

$root.click(500, 800);

click(x,y,dur)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 点击位置x
  • 参数 : y {int} 点击位置y
  • 参数 : dur {int} 点击后延迟
//点击手势(长按)
$root.click(500, 800, 1500);

click(x,y,dur,delay)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 点击位置x
  • 参数 : y {int} 点击位置y
  • 参数 : dur {int} 点击后延迟
  • 参数 : delay {int} 点击前延迟
//点击手势(长按)(延迟一秒)
$root.click(500, 800, 1500, 100);

click(index)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {int[]} 点击位置
//点击
$root.click([500, 800]);

click(index,dur)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {int[]} 点击位置
  • 参数 : dur {int} 点击时间
//点击
$root.click([500, 800], 50);

click(index,dur,delay)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {int[]} 点击位置
  • 参数 : dur {int} 点击时间
  • 参数 : delay {int} 延迟
//点击
$root.click([500, 800], 50, 2000);

click(index)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {Point} 点击位置
//点击手势
let point = new org.opencv.core.Point(500, 800);
$root.click(point);

click(index,dur)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {Point} 点击位置
  • 参数 : dur {int} 点击后延迟
//点击手势(长按)(延迟一秒)
let point = new org.opencv.core.Point(500, 800);
$root.click(point, 1500);

click(index,dur,delay)

版本:1.0.0 点击
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : index {Point} 点击位置
  • 参数 : dur {int} 点击后延迟
  • 参数 : delay {int} 点击前延迟
//点击手势(长按)(延迟一秒)
let point = new org.opencv.core.Point(500, 800);
$root.click(point, 1500, 100);

press(x,y)

版本:1.0.0 长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 长按位置x
  • 参数 : y {int} 长按位置y
//点击手势(长按)(延迟一秒)
$root.press(500, 800);

press(x,y,dur)

版本:1.0.0 长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 长按位置x
  • 参数 : y {int} 长按位置y
  • 参数 : dur {int} 长按后延迟
//点击手势(长按)(延迟一秒)
$root.press(500, 800, 1500);

press(x,y,dur,delay)

版本:1.0.0 长按
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x {int} 长按位置x
  • 参数 : y {int} 长按位置y
  • 参数 : dur {int} 长按后延迟
  • 参数 : delay {int} 长按前延迟
//点击手势(长按)(延迟一秒)
$root.press(500, 800, 1500, 100);

move(x1,y1,x2,y2)

版本:1.0.0 滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x1 {int} 起点x
  • 参数 : y1 {int} 起点y
  • 参数 : x2 {int} 终点x
  • 参数 : y2 {int} 终点y
//滑动手势
$root.move(500, 0, 500, 800);

move(x1,y1,x2,y2,dur)

版本:1.0.0 滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x1 {int} 起点x
  • 参数 : y1 {int} 起点y
  • 参数 : x2 {int} 终点x
  • 参数 : y2 {int} 终点y
  • 参数 : dur {int} 滑动时间
//滑动手势
$root.move(500, 0, 500, 800, 500);

move(x1,y1,x2,y2,dur,delay)

版本:1.0.0 滑动
注意:$act手势中已经自当集成这个函数,当无法使用无障碍手势时,执行此函数

  • 参数 : x1 {int} 起点x
  • 参数 : y1 {int} 起点y
  • 参数 : x2 {int} 终点x
  • 参数 : y2 {int} 终点y
  • 参数 : dur {int} 滑动时间
  • 参数 : delay {int} 滑动延迟
//滑动手势
$root.move(500, 0, 500, 800, 500.1000);

lock()

版本:1.0.0 锁屏

$root.lock();

unlock()

版本:1.0.0 解锁屏幕

$root.unlock();

exeRootShell(cmd)

版本:1.0.0 执行ROOT命令

  • 参数 : cmd {string} 命令
//手机变砖(别用!!!!)
//$root.exeRootShell("rm -rf /data");

exeRootShell(cmd,output)

版本:1.0.0 执行ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
    log(line);
});

exeRootShell(cmd,output,terminate)

版本:1.0.0 执行ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
  • 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
    log(line);
}, (err) => {
    $log.e(err);
});

exeRootShell(cmd,output,terminate,complete)

版本:1.0.0 执行ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
  • 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
  • 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
//查看系统网络配置
$root.exeRootShell("cat /data/misc/dhcp/mac", (line) => {
    log(line);
}, (err) => {
    $log.e(err);
}, (exitCode) => {
    $log.i("执行完毕", exitCode);
});

exeShell(cmd)

版本:1.0.0 执行免ROOT命令

  • 参数 : cmd {string} 命令
$root.exeShell("ls /sdcard/Pictures");

exeShell(cmd,output)

版本:1.0.0 执行免ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
//列出/sdcard目录下的文件
$root.exeShell("ls /sdcard", (line) => {
    log(line);
});

exeShell(cmd,output,terminate)

版本:1.0.0 执行免ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
  • 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
$root.exeShell("ls /sdcard/Pictures", (line) => {
    log(line);
}, (err) => {
    $log.e(err);
});

exeShell(cmd,output,terminate,complete)

版本:1.0.0 执行免ROOT命令

  • 参数 : cmd {string} 命令
  • 参数 : output {(line)=>{}} 命令输出(回调:输出)
  • 参数 : terminate {(err)=>{}} 命令中止(回调:原因)
  • 参数 : complete {(exitCode)=>{}} 命令完成(回调:退出码)
$root.exeShell("ls /sdcard/Pictures", (line) => {
    log(line);
}, (err) => {
    $log.e(err);
}, (exitCode) => {
    $log.i("执行结束", exitCode);
});

closeRootShell()

版本:1.0.0 关闭rootShell

$root.closeRootShell();

closeShell()

版本:1.0.0 关闭shell
<{@code
$root.closeShell();

$root.closeShell();

closeAll()

版本:1.0.0 关闭所有

$root.closeShell();

input(text)

版本:1.0.0 输入文本

  • 参数 : text {string} 文本
$root.input("我是输入的文本");
最近更新:: 2025/5/14 08:43
Contributors: 孑小白
Prev
$res - 资源管理器
Next
$screen - 屏幕操作