Reading Instructions

October 22, 2022

Reading Instructions

This document is for Auto.js (Pro) and explains the usage, role and examples of the APIs for each of the Auto.js modules.

The documentation was generated with the help of the Node.js documentation builder and is open source on github ( ) and is currently maintained by the developer.

API stability

Since Auto.js is in an active state of update and development, the API may change at any time, and we use Stability to mark the stability of modules and functions. These markers include.

Stability: 0 - Deprecated

Deprecated functions, modules or features that will be removed or changed soon in future updates. The use of these functions should be removed from scripts to avoid subsequent unexpected problems.
Stability: 1 - Experimental

Experimental functions, modules, or features that may be changed or removed in future updates. These functions or modules should be used with caution, or only for temporary or experimental purposes.
Stability: 2 - Stable

Stable functions, modules, or features whose existing functions will generally not be changed in future updates and will ensure backward compatibility.

How to read this document

To start with an example, here is part of the description of the input function in the chapter Control-based-automation simulation.

input([i, ]text)

  • i {number} means the input is the i + 1th input box
  • text {string} the text to be entered

input means the name of the function, and the [i, ]text in parentheses is the parameter of the function. The following is the parameter list, "number" means the parameter i is of type numeric, "string" means the parameter text is of type string.

For example, input(1, "la la la la"), executing this statement will enter "la la la la" at the second input box on the screen.

The square brackets [ ] indicate that the argument is optional. That is, you can call input directly without the i. For example, if you call input("heh heh heh"), this statement will type "heh heh heh" in all the input fields on the screen, according to the documentation.

Please do not write square brackets when calling functions with optional arguments.

Let's look at the second example. Partial description of the detectsColor function in images and color processing.

images.detectsColor(image, color, x, y[, threshold = 16, algorithm = "diff"])

  • image {Image} image
  • color {number} | {string} the color to detect
  • x {number} the horizontal coordinate of the position to be detected
  • y {number} the vertical coordinate of the position to be detected
  • threshold {number} The color similarity threshold, default is 16, the range is 0~255.
  • algorithm {string} The color matching algorithm, including:
    • "equal": equal match, only match if the color is exactly equal to the given color.

    • "diff": Difference matching. Match when the sum of the absolute value of the difference between R, G and B of the given color is less than the threshold.

    • "rgb": rgb Euler distance similarity. Matches when the rgb Euler distance of the given color is less than or equal to threshold.

    • "rgb+": weighted rgb Euler distance match (LAB Delta Eopen in new window).

    • "hs": hs Eulerian distance matching. hs is the hue value in HSV space.

Similarly, [[, threshold = 16, algorithm = "rgb"] is an optional parameter and, the value after the equal sign = is the default value of the parameter. That is, if the parameter is not specified, the parameter will be this value.

For example images.detectsColor(captureScreen(), "#112233", 100, 200) is equivalent to images.detectsColor(captureScreen(), "#112233", 100, 200, 16, "rgb"). while images.detectsColor(captureScreen(), "#112233", 100, 200, 64) is equivalent to images.detectsColor(captureScreen(), "#112233", 100, 200, 64, "rgb").

Please do not write square brackets and equal signs when calling functions with optional parameters and default values.

Last update:
Contributors: hyb1996