跳到主要内容

278 篇文档带有标签「参考」

查看所有标签

Clipboard:paste()

将当前剪贴板文本粘贴到已获得焦点的输入字段中。

Color()

用于执行颜色相似度比较的工具类。

Column()

向对话框添加 Column(列)视图

DateTime()

用于执行日期时间计算的实用工具类。

DateTime():day()

返回 DateTime 对象一周中的某天。(星期日为 0,星期一为 1,依此类推)。

DateTime():diff()

计算当前 DateTime 对象与另一个 DateTime 对象之间的差值。

DateTime():endOf()

将 DateTime 对象设置为指定时间单位的结束时刻(例如当天结束、当月结束)。

DateTime():hour()

返回 DateTime 对象一天中的小时。(24 小时制,0-23)。

DateTime():hour()

设置 DateTime 对象一天中的小时。(24 小时制,0-23)。

DateTime():isBetween()

检查当前 DateTime 对象是否介于另外两个 DateTime 对象之间(包含边界)。

DateTime():startOf()

将 DateTime 对象设置为指定时间单位的起始时刻(例如当天开始、当月开始)。

DateTime():unix()

返回 DateTime 对象的 Unix 时间戳(自 Unix 纪元以来的秒数)。

Dialog:add()

向对话框添加视图,目前您只能根据此参数添加视图。

Dialog:init()

要开始使用并显示对话框,必须使用此方法初始化对话框。

Dialog:show()

调用此函数后,对话框将在屏幕上弹出。

Dialog:showIfNeeded()

Shows the dialog only when a question still needs an answer. Otherwise it returns straight away, and the macro uses the saved answers.

EditText()

向对话框视图添加 EditText(文本输入)

GestureRecorder()

The user plays a routine once on their own screen. Every tap, hold and swipe is recorded and passed on to the app, so they can play normally. The answer is a record name for Record:play().

hideWhen()

The opposite of showWhen(): hides an item while a checkbox is ticked, or while an option is chosen. So it shows while the checkbox is not ticked, or while any other option is chosen.

Keyboard

用于在您的设备屏幕上输入文本的有用模块

Keyboard:type()

此方法会模拟键盘在您的屏幕上输入文本,但仅在任意文本输入上有效,在某些应用中无法使用

Macro()

一个扩展模块,用于在运行时以编程方式调用或执行您的宏。

NumberInput()

A field that only takes a number. The answer is a number.

NumberInput():setRange()

Keeps the number between two values. The field shows the range, and OK waits for a number in it.

Page()

One page of a long dialog. The first time, the user answers the pages one at a time with Next and Back; once everything is answered, the pages show as tabs.

RadioGroup()

向对话框视图添加单选组,每个子视图包含单选按钮

RadioGroup():showAsDropdown()

Shows the options as a dropdown instead of round buttons. Better for long lists. The answer is still the id of the chosen RadioButton.

Record

用于回放您的手势/触摸的有用模块

Region()

用于在感兴趣区域(设备屏幕的一部分)中执行检测和 UI 自动化的核心模块。

Region():exist()

检查该区域内是否存在匹配项,如果找到匹配项则返回 true,否则返回 false。

Region():existClick()

执行图像/文本检测并点击其匹配坐标,如果找到匹配项则该方法返回 true。

Region():existClickAll()

执行图像/文本检测并点击其匹配坐标,如果找到匹配项则该方法返回 true。

Region():find()

在该区域内执行图像或文本搜索,如果找到图像或文本则返回 MatchResult,否则返回 nil。

Region():getColor()

获取特定坐标处的像素颜色,随后可使用该颜色比较其相似分数,这对颜色检测非常有用。

Region():getColors()

同时获取多个坐标处的像素颜色,随后可使用这些颜色比较其相似分数,这对颜色检测非常有用。

Region():getText()

该方法在感兴趣区域上执行 OCR,并返回拼接后的文本。

Region():multiSwipe()

在该区域内同时执行最多 10 根手指的滑动。每根手指都按照自身独立的时间轴运作。

Region():screenshot()

截取该区域的截图,并保存到 /data/data/com.androidmacro/images/$macroId/$fileName。

Region():wait()

等待模板出现在该区域内,如果达到超时时间,该方法将抛出错误。

Region():waitVanish()

等待模板在该区域内消失,如果达到超时时间,该方法将抛出错误。

Request()

一个用于执行互联网网络请求的模块,于 1.0.0.31 版本引入。

Request():delete()

执行 DELETE 请求并返回一个 Response 对象。此方法用于从服务器删除资源。

Request():get()

执行 GET 请求并返回一个 Response 对象。此方法用于从指定的 URL 获取数据。

Request():patch()

执行 PATCH 请求并返回一个 Response 对象。此方法用于对服务器上的资源进行部分更新。

Request():post()

执行 POST 请求并返回一个 Response 对象。此方法用于向服务器发送数据,通常用于创建新资源。

Request():put()

执行 PUT 请求并返回一个 Response 对象。此方法用于完全替换服务器上的资源。

Request():setHeader()

为 HTTP 请求设置新的请求头。此方法允许您在发送请求之前为其添加自定义 HTTP 请求头。

Request():setParameter()

为请求体设置参数(与 POST/PUT/PATCH 请求配合使用)。此方法允许您添加将随请求体发送的数据。

Response

Response 对象包含使用 Request 模块发出的 HTTP 请求的结果。它提供了对服务器返回的响应数据、状态码以及其他元数据的访问。

Row()

向对话框添加 Row(行)视图

Screen

该模块的功能与 Region 模块类似,不同之处在于它使用设备的完整宽度和高度。

Screen:exist()

检查设备屏幕上是否存在匹配项,如果找到匹配项则返回 true,否则返回 false。

Screen:existClick()

执行图像/文本检测并点击其匹配坐标,如果找到匹配项则该方法返回 true。

Screen:existClickAll()

执行图像/文本检测并点击其匹配坐标,如果找到匹配项则该方法返回 true。

Screen:find()

在您的设备屏幕上执行图像或文本搜索,如果找到图像或文本则返回 MatchResult,否则返回 nil。

Screen:findAll()

批量执行图像或文本搜索,并返回 MatchResult 列表。

Screen:getColor()

获取特定坐标处的像素颜色,随后可使用该颜色比较其相似分数,这对颜色检测非常有用。

Screen:getColors()

同时获取多个坐标处的像素颜色,随后可使用这些颜色比较其相似分数,这对颜色检测非常有用。

Screen:getText()

该方法在设备屏幕上执行 OCR,并返回拼接后的文本。

Screen:multiSwipe()

同时在屏幕上执行最多 10 根手指的滑动。每根手指都按照自身独立的参数在自己的时间轴上运作——按下、移动、保持和抬起。

Screen:screenshot()

截取整个设备屏幕,并保存到 /data/data/com.androidmacro/images/$macroId/$fileName。

Screen:swipe()

在屏幕上执行单指滑动。滑动路径由一系列 SwipePoint 值定义,手指会依次经过这些点。

Screen:wait()

等待模板出现在屏幕上,如果达到超时时间,该方法将抛出错误。

Screen:waitVanish()

等待模板在屏幕上消失或消失,如果达到超时时间,该方法将抛出错误。

Section()

A titled group of questions the user can fold, such as "Advanced".

setHelp()

Adds a small line of help under an item. Every dialog item has it.

setRequired()

Chooses whether OK waits for an answer to this question. It is on NumberInput, Slider, TapPicker, TapListPicker and GestureRecorder.

Settings:cacheOn()

当此选项设为开启时,宏将存储一个临时缓存以保存上一帧。通常您的宏会在每一帧可用时捕获设备屏幕,这是一项密集型操作,为了防止这种情况,您可以使用此选项

Settings:grayscaleOn()

当此选项设为开启时,文本或图像检测将以灰度模式进行处理,这有助于加快检测过程

Settings:setComparisonHeight()

修改对比高度。该对比高度是 Android Macro 用于计算具有相同宽高比的两台设备之间屏幕分辨率的变量或常量

Settings:setComparisonWidth()

修改对比宽度。该对比宽度是 Android Macro 用于计算具有相同宽高比的两台设备之间屏幕分辨率的变量或常量

showWhen()

Shows a question, text or container only while a checkbox is ticked, or while an option is chosen. Every dialog item has it.

Slider()

The user slides to a number between two values. The label shows the current number. The answer is a number.

SwipePoint()

表示滑动路径中的一个点。与 ScreenmultiSwipe() 配合使用,用于定义手指移动的位置、速度以及停留的时间。

System

用于按下系统按钮的工具类

TapListPicker()

The user taps several spots on their own screen, in order. Each marker shows its number and can be dragged. The answer is a list of Points.

TapPicker()

The user taps a spot on their own screen, then drags the marker to fine-tune it. The answer is a Point.

TextView()

向对话框视图添加 TextView(文本视图)

Toolbar

用于从 Lua 控制 Android Macro 浮动工具栏的工具模块。

Touch

用于处理 Android 设备上触摸交互的接口。

Touch:dispatch()

将所有待处理的触摸事件分发给系统。当您希望确保所有触摸事件被立即处理时,此方法非常有用。

Touch:down()

在指定坐标或点处执行触摸按下动作。

Touch:exit()

退出并清理触摸接口。当您使用完触摸接口后,应该调用此方法。

Touch:init()

初始化触摸接口。在使用任何其他触摸方法之前,必须先调用此方法。

Touch:move()

执行触摸移动动作到指定坐标或点。

Touch:up()

执行触摸抬起动作,在当前位置释放触摸。

Utils

用于显示 Toast、警告、等待等的工具类。

设置

用于修改宏设置并进行优化