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

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

$root

  • 更新时间:2025-07-25 16:49:15

ROOT与Shell工具

hasPermit()

是否获得ROOT权限

  • 返回 : {boolean} 是否获得ROOT权限
  • 版本 : 1.0.0
let has = $root.hasPermit();
alert("是否有root权限", has);

getPermit()

获得root权限

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

click(x, y)

点击

  • 参数 : x {int} 点击位置x
  • 参数 : y {int} 点击位置y
  • 版本 : 1.0.0
//点击手势
$root.click(500, 800);

click(x, y, dur)

点击

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

click(x, y, dur, delay)

点击

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

click(index)

点击

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

click(index, dur)

点击

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

click(index, dur, delay)

点击

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

click(index)

点击

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

click(index, dur)

点击

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

click(index, dur, delay)

点击

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

press(x, y)

长按

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

press(x, y, dur)

长按

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

press(x, y, dur, delay)

长按

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

move(x1, y1, x2, y2)

滑动

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

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

滑动

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

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

滑动

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

lock()

锁屏

  • 版本 : 1.0.0
$root.lock();

unlock()

解锁屏幕

  • 版本 : 1.0.0
$root.unlock();

power()

电源按键

  • 版本 : 1.0.9
$root.power();

exeRootShell(cmd)

执行ROOT命令

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

exeRootShell(cmd, output)

执行ROOT命令

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

exeRootShell(cmd, output, terminate)

执行ROOT命令

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

exeRootShell(cmd, output, terminate, complete)

执行ROOT命令

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

exeShell(cmd)

执行免ROOT命令

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

exeShell(cmd, output)

执行免ROOT命令

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

exeShell(cmd, output, terminate)

执行免ROOT命令

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

exeShell(cmd, output, terminate, complete)

执行免ROOT命令

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

closeRootShell()

关闭rootShell

  • 版本 : 1.0.0
$root.closeRootShell();

closeShell()

关闭shell

  • 版本 : 1.0.0
$root.closeShell();

closeAll()

关闭所有

  • 版本 : 1.0.0
$root.closeShell();

input(text)

输入文本

  • 参数 : text {string} 文本
  • 版本 : 1.0.0
$root.input("我是输入的文本");

killApp(pkgName)

杀死应用 需要root权限

  • 参数 : pkgName {string} 包名
  • 版本 : 1.0.4

lsRunningApps(callback)

列出所有运行的应用 需要root权限

  • 参数 : callback {(pkg)=>{}} 回调(回调:应用包名)
  • 版本 : 1.0.4

home()

回到主页

  • 版本 : 1.0.9
$root.home();

back()

返回按键

  • 版本 : 1.0.9
$root.back();

menu()

菜单按键

  • 版本 : 1.0.9
$root.menu();

recent()

最近任务

  • 版本 : 1.0.9
$root.recent();
最近更新: 2025/5/14 08:43
Contributors: 孑小白
Prev
$res - 资源管理器
Next
$screen - 屏幕操作