Files
AutoJs6/README-en.md

45 KiB
Raw Permalink Blame History

autojs6-banner_800×224

JavaScript automation tool supporting accessibility service on the Android platform

GitHub release (latest by date) GitHub closed issues Created
Rhino Android Studio
CodeFactor Grade JetBrains supporter GitHub License


Languages


The current README.md supports the following languages:


Introduction


Auto.js is a JavaScript automation tool software for the Android platform that supports Accessibility Service.

Auto.js was first released by hyb1996 on 2017/01/27 and ceased maintenance on 2020/03/13, with the final version name being 4.1.1 Alpha2 and build number 461.

AutoJs6 is based on the final project of Auto.js, undergoing secondary development on 2021/12/01 and continues to be open-source and free.

The table below lists some Auto.js-related projects (sorted by development date):

Project App Name Developer Development Start Date Development End Date
Auto.js Auto.js hyb1996 2017/01/27 2020/03/13
Auto.js Pro 7 Auto.js hyb1996 2019/03/13 2019/07/08
Auto.js Pro 8 AutoJsPro hyb1996 2019/10/13 2021/07/24
Auto.js Auto.js M TonyJiangWJ 2019/11/21 -
AutoX Autox.js kkevsekk1 2020/07/24 -
Auto.js Pro 9 AutoJsPro hyb1996 2021/03/28 2023/02/09
AutoJs6 AutoJs6 SuperMonster003 2021/12/01 -
AutoX Autox.js v6 wilinz 2022/05/26 -
AutoX Autox.js v7 aiselp 2024/04/21 -

The dates in the table are estimated and may differ from actual dates.

Auto.js Pro 7/8/9 in the table are paid versions, and the rest are free open-source versions.


Functions


  • Can be used as a JavaScript IDE (code completion/variable renaming/code formatting)
  • Supports automation based on Accessibility Service
  • Supports floating button quick actions (script recording and running/view package name and activity/layout analysis)
  • Supports Selector API and provides control traversal/information retrieval/control operations (similar to UiAutomator)
  • Supports layout interface analysis (similar to Android Studio's LayoutInspector)
  • Supports recording functionality and playback of recorded actions
  • Supports screen capture/save screenshots/color search in images/image matching
  • Supports E4X (ECMAScript for XML) for interface writing
  • Supports packaging script files or projects into APK files
  • Supports expanded functionality using Root privileges (screen click/slide/record/Shell)
  • Supports use as a Tasker plugin
  • Supports connection with VSCode for desktop development (requires AutoJs6-VSCode-Extension plugin)

Environment


  • Android Operating System
  • API 24 (7.0) [N] and above

Manual



Major Changes


Compared to the final open-source version 4.1.1 Alpha2 of Auto.js, the main upgrades or changes in AutoJs6 are:


Version Histories


v6.6.0

2024/12/02 - Built-in module rewrite, upgrade cautiously
  • Hint The built-in modules are rewritten in Kotlin to enhance script execution efficiency, but iterative improvements are needed.
  • Hint The built-in init.js file is empty by default, allowing developers to extend built-in modules or mount external modules.
  • Feature Axios module / Cheerio module (Ref to AutoX)
  • Feature SQLite module for simple operations on SQLite databases (Ref to Auto.js Pro) (See project documentation > SQLite)
  • Feature MIME module for processing and parsing MIME type strings (See project documentation > MIME)
  • Feature Nanoid module for string ID generation (Ref to ai/nanoid)
  • Feature Sysprops module for obtaining runtime environment configuration data (See project documentation > System Properties)
  • Feature OCR module supports Rapid OCR engine
  • Feature Layout analysis supports window switching (Ref to Auto.js Pro)
  • Feature auto.clearCache method supports clearing control caches (Ref to Auto.js Pro)
  • Feature threads.pool method supports simple application of thread pools (Ref to Auto.js Pro)
  • Feature images.matchTemplate method adds useTransparentMask option parameter to support transparent image search (Ref to Auto.js Pro)
  • Feature images.requestScreenCaptureAsync method for asynchronously requesting screenshot permissions in UI mode (Ref to Auto.js Pro)
  • Feature images.requestScreenCapture method adds isAsync option parameter to support asynchronous screenshot capture (Ref to Auto.js Pro)
  • Feature images.on('screen_capture', callback) and other event listener methods support listening for screen capture availability events (Ref to Auto.js Pro)
  • Feature images.stopScreenCapture method supports actively releasing resources related to screenshot applications (Ref to Auto.js Pro)
  • Feature Images.psnr/mse/ssim/mssim/hist/ncc and images.getSimilarity methods for obtaining image similarity metrics
  • Feature images.isGrayscale method for determining whether an image is grayscale
  • Feature images.invert method for negative image conversion
  • Feature s13n.point/time methods for standardizing point objects and duration objects (See project documentation > Normalization)
  • Feature console module's gravity, touchThrough, backgroundTint methods (See project documentation > Console)
  • Feature Mathx.randomInt/Mathx.randomFloat methods for returning random integers or random floating-point numbers within a specified range
  • Feature app.launchDual/startDualActivity methods for handling dual app launch (Requires Shizuku or Root permissions) (Experimental)
  • Feature app.kill method for forcefully stopping an app (Requires Shizuku or Root permissions)
  • Feature floaty.getClip method for indirectly obtaining clipboard content using a floating window
  • Fix Memory leak in View Binding of Fragment subclasses (e.g., DrawerFragment / ExplorerFragment)
  • Fix Instance memory leak in classes such as ScreenCapture / ThemeColorPreference
  • Fix Issue causing app crash when requesting screenshot permissions on Android 14+ (by chenguangming) pr #242
  • Fix Issue causing app crash when starting foreground service on Android 14+
  • Fix Issue with run button in code editor not lighting up properly on Android 14+
  • Fix App may not run properly after packaging due to missing necessary library files issue #202 issue #223 pr #264
  • Fix App crash when editing project due to missing specified icon resources issue #203
  • Fix Unable to use parameters properly to obtain screenshot resources of specified screen orientation when requesting screenshot permissions
  • Fix Issue with some devices unable to add script shortcuts properly (Trial fix) issue #221
  • Fix Cumulative request sending delay issue with methods related to sending requests in http module issue #192
  • Fix Shizuku service may not work properly before AutoJs6 enters the main activity page (Trial fix) issue #255
  • Fix random(min, max) method may have out-of-bounds results
  • Fix Issue where result type parameter of pickup methods cannot be properly passed empty arrays
  • Fix Issue where control rectangle obtained by UiObject#bounds() may be inadvertently modified, breaking its immutability
  • Fix Issue with text/button/input elements where text containing half-width double quotes cannot be parsed properly
  • Fix Issue with text/textswitcher elements where autoLink attribute functionality fails
  • Fix Issue with different scripts erroneously sharing the same ScriptRuntime object
  • Fix Issue with global variables HEIGHT and WIDTH losing dynamically-generated Getter properties
  • Fix Issue with potential high-latency startup caused by RootShell loading on script startup
  • Fix Issue with floating console window background color setting leading to loss of rectangular rounding style
  • Fix Access service auto-start may encounter abnormal service issues (Trial fix)
  • Fix Issue with triggering ViewPager switch when swiping left or right on WebView control on homepage document page
  • Fix Issue with file manager unable to recognize file extensions containing uppercase letters
  • Fix File manager may not automatically recognize project when first entering project directory
  • Fix Issue with file manager page unable to refresh automatically after deleting folder
  • Fix Issue with file manager sorting files and folders where ASCII initial letter names are put back
  • Fix FAILED ASSERTION exception in code editor debug function
  • Fix Issue with unable to debug again properly after closing editor during code editor debug process
  • Fix Issue with potentially omitting end characters when jumping to line end in code editor
  • Fix Issue with flickering screen when starting log activity page on main activity page
  • Fix Issue with packaged app unable to use opencc module properly
  • Improvement Click prompt experience for 'Unavailable ABI' control on package page
  • Improvement Supports using Shizuku to control 'Pointer Location' display switch
  • Improvement Supports using Shizuku to control 'Projection Media' and 'Modify Secure Settings' permission switches
  • Improvement Automator.gestureAsync/gesturesAsync supports callback function parameters
  • Improvement tasks module uses synchronous way for database operations to avoid potential data access inconsistencies
  • Improvement Script execution mode supports pipeline symbol separation mode parameters (e.g., starting with "ui|auto";)
  • Improvement Script execution mode supports single quotes and backticks and allows omitting semicolons (e.g., starting with 'ui'; or 'ui')
  • Improvement Script execution mode supports quick import of built-in extension modules such as axios, cheerio, and dayjs (e.g., starting with "axios";)
  • Improvement Script execution mode supports x or jsox mode parameters for quick enabling of JavaScript built-in object extension modules (e.g., starting with "x";)
  • Improvement img element src and path attributes support local relative paths (e.g., <img src="a.png" />)
  • Improvement Code editor supports intelligently determining insertion location when importing Java classes and package names
  • Improvement images module supports using paths directly as image parameters
  • Improvement importPackage supports string parameters
  • Improvement Server mode IP address supports clipboard import with intelligent recognition and smart conversion with space key
  • Improvement File manager supports default prefix selection when creating new files and automatically generates appropriate numeric suffix
  • Improvement File manager specifically informs on exception message when running project issue #268
  • Improvement File manager supports more types and displays corresponding icon symbols (supports over 800 file types)
  • Improvement Editable file types (jpg/doc/pdf, etc.) in file manager have added edit buttons
  • Improvement APK files in file manager support viewing basic information, Manifest information, and permissions list
  • Improvement Audio/video media files in file manager support viewing basic information and MediaInfo information
  • Improvement Package single file support auto-fill appropriate standardized package name and invalid character filter prompt
  • Improvement Package single file support automatically sets icon and auto-increments version number and version name based on installed same package name application
  • Improvement Package configuration file supports abis/libs option to specify default included ABI architecture and libraries
  • Improvement Support relevant message prompts when abis/libs options of package configuration file are invalid or unavailable
  • Improvement LeakCanary is excluded from official release version to avoid unnecessary growth
  • Improvement All English comments in project source code are accompanied by Simplified Chinese translations to enhance readability
  • Improvement README and CHANGELOG support multi-language (Automatically generated by script)
  • Improvement Enhance Gradle build script's version adaptability
  • Improvement Some dependency or local library version adjustments CHANGELOG.md

v6.5.0

2023/12/02
  • Feature opencc module (Refer to Project Documentation > Chinese Conversion) (Ref to LZX284)
  • Feature UiSelector adds plus and append methods issue #115
  • Feature Packaging application page adds support for filtering ABIs and libraries (Ref to AutoX) issue #189
  • Fix Abnormally large file size issue in packaged applications (Ref to AutoX / LZX284) issue #176
  • Fix Issue where packaged applications cannot display and print some exception messages
  • Fix Issue where selecting application icon on packaging application page might show empty icon
  • Fix Context not initialized exception when packaging application includes MLKit Google OCR library
  • Fix ocr.mlkit/ocr.recognizeText/detect methods not working
  • Fix Mismatch between displayed language and application setting language for some texts (such as log page)
  • Fix Text overflow issue in home page drawer switch items for some languages
  • Fix Issue where accessibility service automatically closes immediately after being enabled on some devices without any prompt messages issue #181
  • Fix Issue where enabling accessibility service on some devices might cause application crash due to physical keys (attempted fix) issue #183 issue #186
  • Fix Issue with pickup functionality after restarting accessibility service using auto(true) (attempted fix) issue #184
  • Fix Issue where creating floating window in floaty module might cause application crash when dragging (attempted fix)
  • Fix Issue where app.startActivity cannot use shorthand parameters issue #182 issue #188
  • Fix Issue where code throws exception when imported class name conflicts with global variable using importClass issue #185
  • Fix Issue where accessibility service cannot be used on Android 7.x
  • Fix Issue where runtime.loadJar/loadDex methods might not work properly on Android 14 (attempted fix)
  • Fix Issue where 'Layout Bounds Analysis' and 'Layout Hierarchy Analysis' are unavailable in Android system quick settings panel issue #193
  • Fix Issue where auto-update check might cause application ANR (attempted fix) issue #186
  • Fix Issue where file manager cannot return to workspace path page after clicking 'Up' button in example code folder issue #129
  • Fix Issue where replace button is not shown when using replace function in code editor
  • Fix Issue where long-press delete in code editor might cause application crash (attempted fix)
  • Fix Issue where fx button in code editor cannot show module function quick panel
  • Fix Issue where module function quick panel button function name might overflow in code editor
  • Improvement The code editor module's quick function panel adapts to night mode.
  • Improvement The startup page of the packaged application is adapted to night mode, and the layout of application icons is adjusted.
  • Improvement The packaged application page supports cursor navigation using the ENTER key on the software keyboard.
  • Improvement The packaged application page supports toggling select-all state by clicking on ABI and library titles.
  • Improvement The default ABI selection is made intelligent on the packaged application page with added guide prompts for unselectable items.
  • Improvement The file manager adjusts the display of menu items based on the type and characteristics of files and folders.
  • Improvement The file manager's folder right-click menu adds a packaging application option.
  • Improvement When accessibility services are enabled but malfunction, an abnormal state is reflected in the drawer switch of the AutoJs6 homepage.
  • Improvement The console includes detailed stack information when printing error messages.
  • Improvement Some dependency or local library version adjustments CHANGELOG.md

v6.4.2

2023/11/15
  • Feature Added inputSingleLine option parameter property to dialogs.build()
  • Feature Added console.setTouchable method issue #122
  • Fix Issue where some methods in ocr module could not recognize region parameters issue #162 issue #175
  • Fix Issue where version details could not be retrieved when a new version is found on Android 7.x
  • Fix Issue where requesting screenshot permission on Android 14 caused application crash
  • Fix Issue where quickly switching 'Floating Button' switch on the home page drawer might cause application crash
  • Fix Issue where floating button might still be displayed after rebooting the application when it was closed using menu
  • Fix Issue where changing AutoJs6 language in settings page could not take effect on systems Android 13 and above
  • Fix Issue where initial build could not automatically complete OpenCV resource deployment using build tools
  • Improvement Native implementation of bridges module to improve script execution efficiency (Ref to aiselp)
  • Improvement Refactored accessibility service related code to enhance stability of accessibility service functionality (experimental) issue #167
  • Improvement Enhanced print output format for UiObject and UiObjectCollection
  • Improvement Added upgrade prompt when Gradle JDK version does not meet the requirements in build tools
  • Improvement Some dependency or local library version adjustments CHANGELOG.md
For more version history, refer to

Project Compilation and Build


For debugging or developing the AutoJs6 open-source project, you can use Android Studio (a product of Google) or IntelliJ IDEA (a product of Jetbrains).

This section introduces the compilation and build methods of the AutoJs6 open-source project using Android Studio as an example. IntelliJ IDEA is similar.

Android Studio Preparation

Download Android Studio Ladybug | 2024.2.1 Patch 2 version (choose one as needed):

Note: The release date for the above version is Oct 31 , 2024. To download other versions, or if the above link is invalid, you can visit the Android Studio release archive page..

Install or extract the above file, then run the Android Studio software (e.g., "D:\android-studio\bin\studio64.exe").

Android SDK Preparation

Note: If the Android SDK is already installed on the computer system, this section can be skipped.

Use CTRL + ALT + S in Android Studio to open the settings page:

Appearance & Behavior -> 
System Settings -> 
Android SDK

If the Android SDK Location field is blank, click the Edit button on the right and click Next multiple times in the pop-up window.

Note: During the process, one or more relevant agreements may need to be accepted to continue.

Once the related resources are downloaded and installed, click the Finish button.
The Android SDK Location field above will auto-populate with the path, completing the SDK preparation work.

Android SDK Tools Preparation

AutoJs6 requires certain SDK tools (like NDK and CMake).

Note: If all required Android SDK Tools for AutoJs6 are already installed on the computer system, this section can be skipped.

Use CTRL + ALT + S in Android Studio to open the settings page:

Appearance & Behavior -> 
System Settings -> 
Android SDK -> 
SDK Tools (located in the right window)

Check Show Package Details, click NDK and CMake respectively to ensure the corresponding version tools are checked, the version information of the SDK tools is located in the version.properties file in the root directory of the AutoJs6 project.

JDK Preparation

The JDK (Java Development Kit) version required for the AutoJs6 project should be at least 17, but 19 or higher is recommended.

As of Dec 2 , 2024, AutoJs6 supports up to version 23 of the JDK.

Note: If the JDK is already installed on the computer system and the version meets the above requirements, this section can be skipped.

JDK can be downloaded directly via the IDE or from the Oracle website.

Use CTRL + ALT + S in Android Studio to open the settings page:

Build, Execution, Deployment -> 
Build Tools -> 
Gradle

Gradle JDK can be chosen or added with different versions of JDK.

If a suitable version of the JDK (>= 17) already exists in the list, it can be selected directly.
Alternatively, you can choose Download JDK to download a suitable JDK, click the Download button and wait for the download to complete.
You can also choose Add JDK to add an existing local JDK, locating its directory and completing the JDK addition.

AutoJs6 Resources Cloning

Click Get from VCS button on the main page of Android Studio.
Fill URL field with https://github.com/SuperMonster003/AutoJs6.git,
The Directory field can be modified to a specific path if needed.
Click the Clone button, wait for the AutoJs6 project resources to be cloned to the local device.

Note: The above process may require the installation of Git.

AutoJs6 Project Building

After cloning, Android Studio will open the AutoJs6 project window and automatically complete the preliminary Dependencies download and Gradle build work.

Note: The above process may take a long time. If network conditions are poor, it may need to be retried multiple times (click the Retry button).

Upon completion of the build, the Build tab in Android Studio will show a message similar to BUILD SUCCESSFUL in 1h 17m 34s.

Package the project and generate an APK file that can be installed on an Android device:

  • Debug Version
    • Build -> Build Bundle(s) / APK(s) -> Build APK(s)
    • Generate signed debug APK
    • Path example: "D:\AutoJs6\app\build\outputs\apk\debug\"
  • Release Version
    • Build -> Generate Signed Bundle / APK
    • Select APK option
    • Prepare the signing file (create new or select existing), generate the signed release package
    • Path example: "D:\AutoJs6\app\release\"

Reference: Android Docs


Script Development Assistance


To develop scripts that run with AutoJs6, appropriate development tools must be used:

For writing and debugging scripts on a PC, the VSCode plugin can enable PC-to-phone connectivity:

When writing code using development tools, code completion functionality can better assist developers in completing code:

When writing code, AutoJs6-related API and usage can be consulted in the documentation at any time:

Existing script development projects can serve as references and inspire creativity for personal script projects:


Contribution


Thank you to everyone who contributed to the AutoJs6 project development.

Contributors Number of Commits Recent Submissions
kvii 1 2024/10/16
chenguangming 2 2024/05/14
LZX284 17 2023/11/19
TonyJiangWJ 4 2023/10/31
littlealei 12 2023/07/12
aiselp 6 2023/06/14
LYS86 2 2023/06/03

Data updated on Oct 23 , 2024.

Data entries sorted in descending order by recent submissions.

Newly initiated, unprocessed Pull Requests will be included in the data statistics after merging.

Some contributors do not appear correctly in the GitHub Contributors due to empty contribution records, but their contribution records can still be viewed via Pull Request.