Autojs 4.1.0 practical course -- the last surprise

Code and Apk are shared to you, each taking what you need, direct Apk on hook, direct source code of programming programmer: https://pan.baidu.com/s/1rXSVZAf2dVfYKiwoLFhSEg Extraction code: nbiw

It's really not easy to write now. Articles are blocked by various platforms. The more dry cargo tiktok, the harder to survive, what is the operation of the jitter, headlines, penguins, 100 homes. Wake up, everyone. Do you know how hard that is? I saw a maniac on the tiktok and sent out a video saying: write 1000 soft articles every day to each platform, so that the monthly income is one hundred thousand. You think we are AI robots. I saw a swearing person on the knowledge, but he scolded it right, shouting tiktok everyday, carrying 5 million fans, and giving out a tutorial. How can it be? If you earn tens of thousands every day, who will post articles. I prohibit the whole process of knowing how to make tiktok. I send a wool to give me a killing. In fact, I don't know if this can be sent out. Let's be the last one. No more work. Research technology can be done. I won't send AutoJs any more. If you have Python fans and AI fans, you can also pay attention to me. In the future, you will focus on Python direction. Such as:

1,  GUI

2,  Flask

3. Reptile

4,  AI

It's off topic. Let's finish the last one!

It can be introduced in three directions: one is software business function, the other is configuration, and the other is core technology,

First, business introduction

There is also an outcome of nearly 90 days and nights of struggle, that is, the individual version of the collection of wool. The personal version lists all the things that I think are reasonable. It can execute code repeatedly and automatically check in in the middle. You can also check in manually. Do not dare to write the business function. Please block the screenshot as soon as you write it!

 

 

 

Second, system configuration

I put the video and the novel together. There are about 30. Actually, old fellow iron can not be used for so much. It takes 24 hours a day to get 10 high-yield items. In addition, I emphasize that we can't learn from Aunt Baiyun, but a raised one will be found. Generally, it's OK to pull for 2 hours. Set 150-200 in the parameter to slide.

In addition, the App supports sorting. The sorting condition is to modify the number first and click to check box. Then the system will sort by numerical index.

Then there is app support for sign in, one click sign in and automatic sign in. It's not recommended to turn on automatic check-in. If you don't install the app, it's easy to get stuck. I haven't solved it yet.

Finally, it is how long the App has been supported. It can be seen clearly on the page that I am using the hundredth system now, so I have the concept of 2 hours and 99 minutes.

 

 

 

 

 

 

 

 

 

In addition, the screen sliding time is configured according to your current network speed. If it's wifi, then 8s is OK. If the traffic is lost, it's 15s because you're 3G and the speed is too slow to load.

It is recommended not to turn on the console. Some events are easily blocked by the console by clicking the screen.

Automatic check-in is best set at 6 a.m., sometimes it will be stuck inexplicably, or simply do not open, manual check-in.

Program off time, if it's personal play, set the morning, let the phone rest.

Whether to turn off the App or not, Huawei mobile phones can be turned on, because all three of my mobile phones are Huawei mobile phones, and other mobile phones should not be turned on. What we call is to click the screen to force the App to turn off, in order to reduce memory waste and improve the utilization rate of mobile phones. But different mobile phones are forced to shut down by clicking. Xiaomi is the most wonderful one. It doesn't do so much compatibility, so we don't need to turn on this function if it's not Huawei.

There's a reason to call the personal edition. Let's give you some answers. AutoJs is a barrier free service based on Android, and this full auto assist is based on Android 7.0 and above. There's a problem. The accessibility service is extremely unstable. It's common for me to shut it down for some reason, especially my Huawei mate10 (don't laugh at the broken mobile phone). I found a little secret. Haha, considering the value, Android 7.0 always lights up and runs AutoJs accessibility service without being shut down. It's really hard to think of a cluster in such a mode.

If a studio wants to make a ROOT version, the r-free version is not stable. Of course, R's are also problematic. You all know

In the end, I put the refined apps of 90 days and nights in the top 9. You can check whether the picture is missed. There's also the software that automatically brushes is entertainment. Entertainment and entertainment should not rely on a sheep to collect wool to make a fortune. We can't learn from Aunt Baiyun.

Third, core technology

AutoJs itself has encapsulated the barrier free core, and we are only applying it. Once again, I would like to emphasize the use of AutoJs version 4.1.0. Although there is BUG, it has basically completed the core task, and I like it for the author. This App I wrote has such a pain point that more than 3000 lines of code are actually on one page. I have tried many times to package and run AutoJs 4.1.0 to report errors when doing projects, so there is no way to only single file, and it cannot be debugged, relying on memory and logic. Take a picture for the brothers.

 

 

 

Form loading is the content of system initialization, such as building menu, UI and other operations.

Form events are events of various buttons and events of binding list.

 

 

 

Business code is the operation of each App. If there is special processing, public methods will be executed.

Public functions, which should be emphasized, in fact, I think the whole code is the most important. It can be reused to other UI navigation areas infinitely. In addition, ui.layout is also very, very important. The common function code is shared with you:

 

/**
 *Click on the screen
 */
function clickScreen() {
    var x = device.width -device.width*0.2;
    var y = device.height-device.height*0.2 ;
    toastLog("Click on the screen" + x + ":" + y);
    let clickResult= click(x, y);
    toastLog("Click the screen to return to the value:"+clickResult);
}
/**
 * Screen slide down and delay 8 to 12 seconds
 */
function slideScreenDown(startX, startY, endX, endY, pressTime) {
    swipe(startX, startY, endX, endY, pressTime);
    let delayTime = random(8000, 12000);
    sleep(delayTime);//Imitating human random time
}
/**
 * Pull wool App suspension frame
 */
function woolFloaty() {
    var window = floaty.rawWindow(
        <relative id='main' layout_width="match_parent" layout_height="wrap_content" alpha="0.6" >
            <img w="44" h="44" src="#ffffff" circle="true" alpha="0.8" />
            <img id="img_logo" w="32" h="32" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAADOElEQVRYR81XT0gUYRT/vQmxWTWp9Bhmh/4cOwR1KAq6BUVFGTW7ZYXhzEqXDkFCCkVQR90Rgyyc2VD7A0XHoK0unqpbEJRatzQlc2f8g/Nixp111l13v3WVmtPMx3u/95v3vfe930cQfEYfXKyqKJcPE6iB2dkOohoCNrvuDPwC8xiR9IXB/ckZ+3XtpZ4/ItBUyGimV93F66jFYZwhYGMh+xShCYnQR/PcUR7RP+fzyUvANtVbBGphYINI4KU2BEwyuENW9Nbl/JclYJvqO4D2ryRwtg+/lxX9QC6snAQsUx0lUM3qBF9AYfBYSNFrc2Qpc8k2tSEAW1czeABrWFZi9UHsjAzYhjoAolNrFDyVCn4ih/XTfow0AbfgALqxpsHT4HzbL0yPgNdqEg2utNqLJe12Bzm8121Rj8B0XNOZ0ZwXyOFGkDTs2RCfB3Ahw574Mhzpa2qtHsQ9efuf0LX+XEyl8e6m6lBl2Qgzqgv8SbqAJh9Gd5aVccYBIyuxwHZq4yhwaBHhtzU1V0d2XAuD0SuURocb5Yj+yLW1TdUASPFajNEVCsdU990yoteI+J4QHiFClqE9JcJJIQcgnYWk0XxEIunVQo9L+0JKx+ACMY0FsVziz8gy1A9EtFvUCYEsWKb2CYy5UDi2x/t7U71DoOuiWMz8kSxT+07AFlEnBLIwE9da55lnQ4p+9+eAWlk1S0IT0I/FwA+yTS0JIFQEAfhZmDau7mCen5UjnUPTca2bGU1F4QBWMQQSYGr3A8jhzoT/bse1Oji0eMQSvxEkYhWzBRkE3AA+CduIHlxyJggR8Lag6CJMRXKY2yvCepv7mTTUNonopuBfp828IrTNaB/ADQLOCVmJHRKwK6IVqd/dguMEPBcATjjMb4N2wQwE10WzwcAJSonNEVG95wcqdQsYmEjO2HXiw2hJikolQP4wcnFXMo5LIZA1jlPD5d8JkvSBsqpKeLmyzlTIWap4LRTx4tmfrYxzyvI1UsZZitgltvzFZDUVMmcq4eDm/L9XM5+lfzkFcFZAN3purt4D8Ljky2kwVa54lSvLjrKDYwBvy3U9B+gbSXhhT8293HTlvkui4PMXv9aNop02ZWsAAAAASUVORK5CYII=" gravity="center" layout_gravity="center" />
            <img id="logo_click" w="*" h="*" src="#ffffff" alpha="0" />
        </relative>
    );
    window.setPosition(device.width, device.height / 2)
    setInterval(() => { }, 1000);
    //Record the touch coordinates when the key is pressed
    let x = 0;
    let y = 0;
    //Record the position of the float window when the key is pressed
    let windowX;
    let windowY;
    //move windows
    //If the press time exceeds this value, long press and other actions will be executed
    let downTime = 500;
    //Record the return of timing actuator id
    let Timeout = 0;
    window.setSize(100, 100);

    window.main.setOnTouchListener(
        function (view, event) {
            switch (event.getAction()) {
                case event.ACTION_DOWN:
                    x = event.getRawX();
                    y = event.getRawY();
                    windowX = window.getX();
                    windowY = window.getY();
                    //Create a timer to perform a long press operation.
                    Timeout = setTimeout(() => {
                        toast("The thread has been shut down!");
                        threads.shutDownAll();
                        Timeout = 0;
                    }, downTime);
                    return true
                case event.ACTION_MOVE:
                    //If the moving distance is too large, it will be judged as the moving state
                    if (Math.abs(event.getRawY() - y) > 5 && Math.abs(event.getRawX() - x) > 5) {
                        //Move status clear timer
                        if (Timeout) {
                            //If the timer exists, the timer will be cleared.
                            clearTimeout(Timeout);
                            Timeout = 0;
                        };
                        //Adjust the position of the suspension window when you move your fingers
                        window.setPosition(windowX + (event.getRawX() - x), windowY + (event.getRawY() - y));
                    };
                    return true;
                case event.ACTION_UP:
                    if (Timeout) {
                        //Clear the timer.
                        clearTimeout(Timeout);
                        Timeout = 0;
                        //Execute the click event.
                        toast("click");
                    };
                    return true;
            }
            return true
        }
    )
}
/**
 * Screen slide down and delay 8 to 12 seconds
 */
function slideScreenDown(startX, startY, endX, endY, pressTime, timesInterval) {
    swipe(startX, startY, endX, endY, pressTime);
    let randomMin = timesInterval * 1000;
    let randomMax = (parseInt(timesInterval) + 2) * 1000;
    let delayTime = random(randomMin, randomMax);
    sleep(delayTime);
}
/**
 * Output Tosat and Info logs
 * @param {Log message} message 
 */
function toastInfo(message) {
    toast(message);
    console.info(getTime()+""+message);
}
/**
 * Output Tosat and Error logs
 * @param {Log message} message 
 */
function toastError(message) {
    toast(message);
    console.error(getTime()+""+message);
}
function toastLog(message){
    toast(message);
    console.log(getTime()+""+message);
}
function toastWarn(message){
    toast(message);
    console.warn(getTime()+""+message);
}
/**
 * Linked array and returns a new array
 * @param {Original array}} compositeArray 
 * @param {Linked array} concatArray 
 */
function concatArray(compositeArray, concatArray) {
    for (var element in concatArray) {
        if (typeof (concatArray[element]) == "function") {
            continue;
        }
        compositeArray.push(concatArray[element]);
    }
    return compositeArray;
}
/**
 * Get the current time format yyyyMMdd
 */
function getDate() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    };
    var day = date.getDate();
    if (day < 10) {
        day = "0" + day;
    };
    return year + "-" + month + "-" + day;
}
/**
 * Get the current time format yyyyMMddHHMMSS
 */
function getTime() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    };
    var day = date.getDate();
    if (day < 10) {
        day = "0" + day;
    };
    var hour = date.getHours();
    if (hour < 10) {
        hour = "0" + hour;
    };
    var minute = date.getMinutes();
    if (minute < 10) {
        minute = "0" + minute;
    };
    var sec = date.getSeconds();//Get seconds
    return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + sec;
}
/**
 * Force app stop
 * @param {App name} appName 
 */
function stopApp(appName) {
    try {
        openAppSetting(getPackageName(appName));
        sleep(3000);
        if (className("android.widget.Button").text("Forced stop").exists()) {
            className("android.widget.Button").text("Forced stop").findOnce().click();
        }
        sleep(3000);
        if (className("android.widget.Button").text("Determine").exists()) {
            className("android.widget.Button").text("Determine").findOnce().click();
            toastLog(appName + "It's stopped!");
        }
        else {
            let closeButton = className("android.widget.Button").text("Forced stop").find();
            closeButton[0].click();
            toastLog(appName + "It's stopped!");
        }
    } catch (e) {
        toastLog(e);
    }
}
/**
 * JS Build Map
 */
function Map() {
    var obj = {};
    this.put = function (key, value) {
        obj[key] = value;//Bind key value to obj On object
    }
    //size Method, getting Map Number of containers
    this.size = function () {
        var count = 0;
        for (var attr in obj) {
            count++;
        }
        return count;
    }
    //get Method according to key Obtain value Value
    this.get = function (key) {
        if (obj[key] || obj[key] === 0 || obj[key] === false) {
            return obj[key]
        } else {
            return null;
        }
    }
    //remove Method,Delete method
    this.remove = function (key) {
        if (obj[key] || obj[key] === 0 || obj[key] === false) {
            delete obj[key]
        }
    }
    //each Method,traversal method 
    this.eachMap = function (callBack) {
        for (var attr in obj) {
            callBack(attr, obj[attr])
        }
    }

}
function bSort(arr) {
    var len = arr.length;
    for (var i = 0; i < len - 1; i++) {
        for (var j = 0; j < len - 1 - i; j++) {
            // The adjacent elements are compared, the elements are exchanged, and the large elements are exchanged to the back
            if (arr[j] > arr[j + 1]) {
                var temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    return arr;
}
/**
 * map Sorting (the core is bubbling a little stupid)
 */
function mapSort(mapTask) {
    // threads.start(function () {
    //     console.show();
    // });
    
    var arr = [];
    var result = [];
    mapTask.eachMap(function (key, value) {
        arr.push(parseInt(value));
        result.push(key);
    });
    var len = arr.length;
    for (var i = 0; i < len - 1; i++) {
        for (var j = 0; j < len - 1 - i; j++) {
            // The adjacent elements are compared, the elements are exchanged, and the large elements are exchanged to the back
            if (arr[j] > arr[j + 1]) {
                var temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
                //value exchange key You have to change
                var keyTemp = result[j + 1];
                result[j + 1] = result[j];
                result[j] = keyTemp;
            }
        }
    }
    //toastInfo(arr);
    //toastInfo(result);
    return result;//Return array  
    // for (var i = 0; i < len; i++) {
    //     for (var j = 0; j < len - i - 1; j++) {
    //         toastInfo(arr[j]);
    //         toastInfo(arr[j + 1]);
    //         toastInfo(arr[j] > arr[j + 1]);
    //         if (arr[j] > arr[j + 1]) {
    //             //Comparison of adjacent elements  
    //             var valueTemp = arr[j + 1];//Exchange element  
    //             arr[j + 1] = arr[j];
    //             arr[j] = valueTemp;
    //             //value exchange, key exchange
    //             var keyTemp = result[j + 1];
    //             result[j + 1] = result[j];
    //             result[j] = keyTemp;
    //         }
    //     }
    // }
    
}

 

This is the end of the autojs 4.1.0 series. Welcome to reprint, comment and concern.

Finally, we will share the code and Apk to all of you, each taking what he needs, the direct Apk on the hook, and the direct source code of the programming programmer: https://pan.baidu.com/s/1rXSVZAf2dVfYKiwoLFhSEg Extraction code: nbiw

Tags: Android Mobile Programming Python

Posted on Thu, 07 May 2020 22:08:30 -0700 by Hodo