Use auto.js to realize the automatic daily check-in function

Use auto.js to realize the automatic daily check-in function

Use auto.js to automate daily check-in

Due to the epidemic, I need to check in at home on time every day. When I just wake up every day, I can’t avoid being inattentive or not being able to see the app or click the button (I’m just making that up).

So, I wanted to create something that can automate the process so that I don’t have to do the tedious daily clocking in.

I did it right away, and then I remembered the accessibility script for stacking cats that I wrote before Double Eleven, so this is not a problem at all.

Tool library used: auto.js

Because auto.js needs to rely on barrier-free operation on Android phones. So currently it only supports Android phones and needs to be on Android 6.0 or above. The official website has detailed introductions, so I won’t go into details here. One more thing to say, the author of auto.js stopped maintaining it in 2019, so I chose another library that took over auto.js: autox.js. They are both very similar, so it doesn’t matter which one you use.

Practical operation

First, you need to make sure that your computer and mobile phone are on the same network, install vscode on your computer, and search for the plug-in "auto.js" to install it. You can also edit the code on your phone, but it's really inconvenient. After the installation is complete, press "cmd+shift+P" and enter "auto". The relevant settings will appear in the list below. Click "Start Service" to edit the auto.js code on your computer.

You need to open the settings on your mobile phone and click "Connect to Computer", enter the computer IP, and you can see the prompt of the new device connection on the computer. (Note that you must first choose to turn on the service on your computer before you can connect)

Next, you can use auto.js on the mobile phone to debug and analyze the layout of each page.

After writing the code, click Save to All Devices on vscode, and the code on the computer will be synchronized to the phone. Click the run button of the plug-in to see the entire running process.

There are also a lot of tutorials on script writing and operation. I just wrote the code for this requirement and didn’t go into it too much. If you are interested, you can learn it by yourself. Here I will just talk about some of the problems I encountered.

  • When two components on a page have the same status, they need to be clicked using hard-coded coordinates. By turning on "Pointer Position" in the developer options on your phone, you can clearly see the coordinates of the current finger touch location.
  • Sometimes the clickable property of a button is not available. You can try click("text to be clicked"), which will work wonders.

Finally, the completed script can be packaged and distributed using auto.js's "packaged application".

Finally, here is the code:

auto()
auto.waitFor();
console.show(true); //Open the console console.log("i Light Industry University automatic clock-in script");
console.log("version--------1.1");
console.log("autuer---zhaosheng");
app.launch('io.cordova.zhqy')
console.log("app has been opened");

sleep(5000);
//Click on application servicevar fuwu = text("Application Service").findOnce();
fuwu.click();
console.log("Select application service");
sleep(2000)
console.log("Click on epidemic prevention and control");
click("Epidemic Prevention and Control")
sleep(2000)
// 2. Home study className("android.view.View").depth(11).desc("home").findOne().click();
console.log("Click to study at home");
// id("home").findOne().click()
sleep(1500)
//Health Daily// click(222,945)
console.log("Click on Health Daily");
click("Health Daily")
sleep(2000)
//Select the current date // 1. Get today's date console.log("Calculate the current date");
var myDate = new Date();
let day = myDate.getDate(); //Corresponding page numberif(day < 10){
   day = "0"+day
   console.log("Current is:"+day);
}
// alert(day)
click(day)
console.log("Click to check in now");
click("Check in now")
sleep(3000)
click("Click to get current location")
sleep(2000)
click(244,2130)
sleep(3000)
swipe(550,1925,550,465,2000)
swipe(550,1925,550,465,2000)
sleep(2000)
click(493,2095)
sleep(2000)
click(764,1638)

This is the end of this article about using auto.js to realize automated daily punch-in. For more related auto.js automated daily punch-in content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • The latest popular script Autojs source code sharing
  • Auto.JS implements the functions of automatic like, automatic screen sliding and automatic video switching for Douyin and other video apps
  • Auto.js automatically collects energy from yourself and your friends in Ant Forest
  • js development autocomplete="off" invalid solution in chrom
  • jquery.AutoComplete.js Chinese revised version (support firefox)

<<:  Detailed explanation of the underlying encapsulation of Java connection to MySQL

>>:  Nginx configuration location matching rules example explanation

Recommend

HTML Editing Basics (A Must-Read for Newbies)

Open DREAMWEAVER and create a new HTML. . Propert...

Introduction to Javascript DOM, nodes and element acquisition

Table of contents DOM node Element node: Text nod...

Use of Linux usermod command

1. Command Introduction The usermod (user modify)...

Analyze the working principle of Tomcat

SpringBoot is like a giant python, slowly winding...

How to set up virtual directories and configure virtual paths in Tomcat 7.0

Tomcat7.0 sets virtual directory (1) Currently, o...

How to set process.env.NODE_ENV production environment mode

Before I start, let me emphasize that process.env...

Detailed explanation of MySql installation and login

Check if MySQL is already installed in Linux sudo...

Web Design Tutorial (7): Improving Web Design Efficiency

<br />Previous article: Web Design Tutorial ...

Document Object Model (DOM) in JavaScript

Table of contents 1. What is DOM 2. Select elemen...

Detailed explanation of Nginx reverse proxy example

1. Reverse proxy example 1 1. Achieve the effect ...

js to call the network camera and handle common errors

Recently, due to business reasons, I need to acce...

The front end creates and modifies CAD graphics details through JavaScript

Table of contents 1. Current situation 2. Create ...

In-depth analysis of the Identifier Case Sensitivity problem in MySQL

In MySQL, you may encounter the problem of case s...

Usage and best practice guide for watch in Vue3

Table of contents Preface🌟 1. API Introduction 2....

Several ways to encrypt and decrypt MySQL (summary)

Table of contents Written in front Two-way encryp...