Skip to main content

278 docs tagged with "Reference"

View all tags

Color()

Utility class to perform color similarity

Color():red()

Extracts the red color value from a hex color string.

DateTime()

Utility class to perform datetime calculations

DateTime():day()

Returns the day of the week of the DateTime object. (Sunday is 0, Monday is 1, etc.).

DateTime():diff()

Calculates the difference between the current DateTime object and another DateTime object.

DateTime():endOf()

Sets the DateTime object to the end of a specified unit of time (e.g., end of the day, end of the month).

DateTime():hour()

Returns the hour of the day of the DateTime object. (24-hour format, 0-23).

DateTime():hour()

Sets the hour of the day of the DateTime object. (24-hour format, 0-23).

DateTime():isBetween()

Checks if the current DateTime object is between two other DateTime objects (inclusive).

DateTime():isSame()

Checks if the current DateTime object is the same as another DateTime object.

DateTime():local()

Converts the DateTime object's timezone to the system's default local timezone.

DateTime():startOf()

Sets the DateTime object to the start of a specified unit of time (e.g., start of the day, start of the month).

DateTime():tz()

Sets the DateTime object's timezone to a specified timezone ID.

DateTime():unix()

Returns the Unix timestamp (seconds since Unix epoch) of the DateTime object.

DateTime():valueOf()

Returns the primitive value of the DateTime object, which is the number of milliseconds since the Unix epoch.

Dialog:add()

Adds a question, a piece of text or a container to the dialog. They show in the order you add them.

Dialog:init()

To start using and displaying the dialog, this method is required to initialize the dialog

Dialog:show()

Shows the dialog and waits until the user presses OK.

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.

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

Useful module to type text into your device screen

Keyboard:type()

This method will simulate keyboard typing to your screen, but only works on any text input not working in some apps

Macro()

An extension module for calling or executing your macro programatically at runtime

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.

Point()

Coordinate of x and y in screen

RadioGroup()

Add radio group to dialog view, each child view contains Radio Button

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

Useful module to replay your gestures/touches

Record:play()

Plays a touch record: one you recorded, or one a user recorded in a dialog's GestureRecorder.

Region()

The core module for detecting and performing ui automation in a region of interest which is a part of screen device

Region():clickAll()

To perform image/text detection and click it's match coordinate in bulk manner

Region():exist()

To check if match exist in the region, if match is found then this method returns true else false

Region():existClick()

To perform image/text detection and click it's match coordinate, if match is found then this method returns true

Region():existClickAll()

To perform image/text detection and click it's match coordinate, if match is found then this method returns true

Region():find()

To perform image or text search in the region, if the image or text is found return the MatchResult else return nil

Region():findAll()

To perform image or text search in bulk manner and return a list of MatchResult

Region():getColor()

To get color pixel in certain coordinate, later this color can be used to compare if color has similar score, this is useful to do color detection

Region():getColors()

To get color pixel in multiple coordinates at the same time, later these colors can be used to compare if color has similar score, this is useful to do color detection

Region():getText()

This method performs OCR in region of interest and return the concatenated text

Region():multiSwipe()

Perform up to 10 fingers swipe simultaneously within the region. Each finger operates on its own independent timeline.

Region():screenshot()

Take a screenshot of region and save it to /data/data/com.androidmacro/images/$macroId/$fileName

Region():wait()

Wait until template appear in the region, if timeout reached this method will throw an error

Region():waitVanish()

Wait until template disappear or vanish in the region, if timeout reached this method will throw an error

Request()

A module for performing network request to the internet that was introduced on version 1.0.0.31

Request():delete()

Execute a DELETE request and return a Response object. This method is used to delete a resource from a server.

Request():get()

Execute a GET request and return a Response object. This method is used to retrieve data from a specified URL.

Request():patch()

Execute a PATCH request and return a Response object. This method is used to partially update a resource on a server.

Request():post()

Execute a POST request and return a Response object. This method is used to send data to a server, typically to create a new resource.

Request():put()

Execute a PUT request and return a Response object. This method is used to completely replace a resource on a server.

Request():setHeader()

Set a new header for HTTP requests. This method allows you to add custom HTTP headers to your request before sending it.

Request():setParameter()

Set a parameter for the request body (used with POST/PUT/PATCH requests). This method allows you to add data that will be sent in the request body.

Response

The Response object contains the result of an HTTP request made with the Request module. It provides access to the response data, status code, and other metadata returned by the server.

Row()

Add Row view to dialog

Screen

The module has similar functionality with Region module, except it uses full device width and height

Screen:click()

To perform parameterize click behaviour using MatchResult

Screen:clickAll()

To perform image/text detection and click it's match coordinate in bulk manner

Screen:exist()

To check if match exist in device screen, if match is found then this method returns true else false

Screen:existClick()

To perform image/text detection and click it's match coordinate, if match is found then this method returns true

Screen:existClickAll()

To perform image/text detection and click it's match coordinate, if match is found then this method returns true

Screen:find()

To perform image or text search in your device screen, if the image or text is found return the MatchResult else return nil

Screen:findAll()

To perform image or text search in bulk manner and return a list of MatchResult

Screen:getColor()

To get color pixel in certain coordinate, later this color can be used to compare if color has similar score, this is useful to do color detection

Screen:getColors()

To get color pixel in multiple coordinates at the same time, later these colors can be used to compare if color has similar score, this is useful to do color detection

Screen:getText()

This method performs OCR in device screen and return the concatenated text

Screen:multiSwipe()

Perform up to 10 fingers swipe simultaneously to the screen. Each finger operates on its own independent timeline — touching down, moving, holding, and lifting according to its own parameters.

Screen:screenshot()

Take a screenshot the entire device screen and save it to /data/data/com.androidmacro/images/$macroId/$fileName

Screen:swipe()

Perform a single-finger swipe on the screen. The swipe path is defined by a list of SwipePoint values that the finger moves through sequentially.

Screen:wait()

Wait until template appear in the screen, if timeout reached this method will throw an error

Screen:waitVanish()

Wait until template disappear or vanish in the screen, if timeout reached this method will throw an error

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

Useful to modify macro settings & optimization

Settings:cacheOn()

When this option is set to on, the macro will store a temporary cache to store last frame, normally your macro will capture the screen device every time frame is available, this is an intensive operation so in order to prevent that you can use this options

Settings:getMinScore()

Will return the minimum match score as threshold when you perform text or image detection

Settings:grayscaleOff()

When this option is set to off, the text or image detection will be processed in normal mode

Settings:grayscaleOn()

When this option is set to on, the text or image detection will be processed in grayscale mode, this is useful to speed up the detection process

Settings:setComparisonHeight()

Change the comparison height, this comparison height is a variable or constant that the Android Macro used to calculate screen resolution between 2 devices with the same aspect ratio

Settings:setComparisonWidth()

Change the comparison width, this comparison width is a variable or constant that the Android Macro used to calculate screen resolution between 2 devices with the same aspect ratio

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()

Represents a point in a swipe path. Used with ScreenmultiSwipe() to define where the finger moves, how fast, and how long it pauses.

System

Utility class to press system button

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.

Toolbar

Utility module for controlling the floating Android Macro toolbar from Lua.

Touch

Interface for handling touch interactions on Android devices.

Touch:dispatch()

Dispatches all pending touch events to the system. This method is useful when you want to ensure all touch events are processed immediately.

Touch:down()

Performs a touch down action at the specified coordinates or point.

Touch:exit()

Exits and cleans up the touch interface. This method should be called when you're done using the touch interface.

Touch:init()

Initializes the touch interface. This method must be called before using any other touch methods.

Touch:move()

Performs a touch move action to the specified coordinates or point.

Touch:up()

Performs a touch up action, releasing the touch at the current position.

Utils

Utility class to show toast, alert, sleep and more