Do not let me help you levy the line does not? To levy a script to automatically receive meow currency

These days, two-eleven activities have not put your toss is not light it? If not, there are only two possibilities: First, you do not have a girlfriend; two, you do not have female friends, or you will receive the following message

 

 

 

 

You know Ali will be issued each year a large number of red envelopes, all kinds of coupons and various mutual aid game ...... And these days, Dad's horse "ATM" who may have indulged in these mutual aid game can not get away, my day three times daily: sign up? Do the task yet? Why upgrade? :

 

 

 

 

Generally, we programmers are not much interested in this game, after all, have to find endless day Bug, plus endless classes, but at this time if you goddess for help against you, that you will rank you take the shot it?

 

 

 

 

So, the programmer how can you miss such a show in front of the goddess of expertise when it, this is not, today, ape sister found it on GitHub, programmers wrote a small script that can automatically do every day tasks, receive meow currency, this time levy to help the goddess, no longer have to worry about the low level:

 

 

 

 

Can be seen at present this little script has not attracted the attention of programmers, have not obtained a star (GitHub address: https: //github.com/sleepybear1113/taobaoVisitingVenues)

In fact, the script is not difficult, based on the framework auto.js to achieve, auto.js is a support JavaScript IDE on the Android platform accessible services to the controls as the basis to automatically run some operations, achieve the floating window record and run. So this script only supports Android system.
Detailed script code is as follows:

let deviceWidth = device.width;
let deviceHeight = device.height;

function openBeginningBtnItem(delay) {
    let items = textStartsWith("gif;base64").depth(19).find();
    the console.log ( "Looking - Mew collar credits" );
     IF (items.length> 0 ) {
        let item = items[items.length - 1];
        console.log ( "click - collar meow currency" );
        clickItemInCenter(item);
        sleep(delay);
        return 1;
    }
    return -1;
}

function isOpenBeginning() {
    let signIn = textContains("签到").findOnce();
    if (signIn != null) {
        console.log ( "Success - Open collection center" );
         return 1 ;
    }
    return -1;
}

function ensureOpenBeginning(waitDelay) {
    if (isOpenBeginning() === -1) {
        openBeginningBtnItem(waitDelay);
    }
    if (isOpenBeginning() === 1) return 1;

    console.error ( "fail - open collection center" );
    Toast ( "failed - to open the collection center" );
     return -1 ;
}

function clickItemInCenter(item, time) {
    if (time == null) time = 50;
    if (item == null) return;
    let x = item.bounds().centerX();
    let y = item.bounds().centerY();
    press(x, y, time);
}

function goShopping() {
    Shopping the let = text ( "to browse") .findOne (1000 );
     IF (Shopping == null ) {
        toastLog ( "End - Unknown problem" );
         return -1 ;

    }
    console.log ( "start browsing ..." );
    clickItemInCenter(shopping);
    return 1;
}

function swipeUp() {
    let x = parseInt(deviceWidth / 2);
    let duration = 500;
    let y = [parseInt(deviceHeight * 0.75), parseInt(deviceHeight * 0.25)];
    swipe(x, y[0], x, y[1], duration);
    swipe(x, y[0], x, y[1], duration);
}

function isFull () {
     for (the let I = 0; I <10; I ++ ) {
         IF (descContains ( "reached the limit") .findOnce () || textContains ( " reached the limit" ) .findOnce ()) {
            console.log ( "Today reached the limit" );
             return 1 ;
        }
        sleep(1000);
    }
    return 0
}


function waitSwipe() {
    let swipeAppear;
    let shoppingFull;
    for (let i = 0; i < 3; i++) {
        swipeAppear = desc ( "swipe too") .findOne (1000 );
         IF (! swipeAppear = null ) BREAK ;
        shoppingFull = descContains ( "reached the limit") .findOne (1000 );
         IF (! shoppingFull = null ) return 0 ;
        console.log("i" + i);
    }

    sleep(1000);

    if (swipeAppear != null) {
        the console.log ( "begin to slip" );
        swipeUp();
        console.log ( "wait 15s" );
        sleep(1000 * 16);
    } else {
        console.log("slow");
        console.log ( "wait 20S" );
        sleep(1000 * 20);
    }

    shoppingFinish the let = desc ( "task complete") .findOne (2000 );
     IF (! shoppingFinish = null ) {
        console.log ( "Walk around, ready to return" );
    } else {
        toastLog ( "unknown walk around, return" );
    }

    return 1;
}

function browseFinish() {
    for (let i = 0; i < 10; i++) {
        normalFinishDesc the let = descContains ( "has been" ) .findOnce ();
        normalFinishText the let = textContains ( "has been" ) .findOnce ();
        swipeFinish the let = desc ( "task completion" ) .findOnce ();

        if (normalFinishDesc != null || swipeFinish != null || normalFinishText != null) {
            console.log ( "browse End" );
             return 0 ;
        }
        sleep(250);
    }

    console.log ( "browse unknown" );
     return -1 ;
}

function judgeWay() {
    let timeOut = 1000 * 7;
    let delay = 250;
    let loops = parseInt(timeOut / delay);
    for (let i = 0; i < loops; i++) {
        swipeAppearDesc the let = descContains ( "swipe too" ) .findOnce ();
        swipeAppearText the let = textContains ( "swipe too" ) .findOnce ();
         IF (! swipeAppearDesc = null ! || swipeAppearText = null ) {
            console.log ( "acquired to slide browsing mode" );
             return 0 ;
        }

        let directBrowseDesc = desc("浏览").findOnce();
        let directBrowseText = text("浏览").findOnce();
        if (directBrowseDesc != null || directBrowseText != null) {
            if (descContains("00喵币").findOnce() != null || textContains("00喵币").findOnce() != null) {
                console.log ( "acquired to normal browsing mode" );
                 return 1 ;
            }
        }

        sleep(delay);
    }

    the console.log ( "timeout" );
     return -1 ;
}

function reopenAgain() {
    console.log("reopen");
    let tbs = id("taskBottomSheet").findOnce();
    if (tbs == null) return -1;
    let close = tbs.child(1);
    if (close != null) {
        the console.log ( "Close" );
        clickItemInCenter(close);
        sleep(1000);
        return ensureOpenBeginning(1000);
    }
    return -1;
}

function runGoShopping () {
    let isSuccess;

    for (let i = 0; i < 20; i++) {
        isSuccess = ensureOpenBeginning(1000);
        if (isSuccess !== 1) break;
        isSuccess = goShopping();

        let count = 0;
        while (isSuccess !== 1) {
            if (reopenAgain() === 1) {
                isSuccess = 1;
                break;
            }
            if (count++ >= 2) break;
        }

        if (isSuccess === -1) break;

        let st = waitSwipe();
        if (st === 0) {
            toastLog ( "reached the limit, the end of the script" );
             return 0 ;
        }

        back();
        sleep(1000);
    }


    if (isSuccess === 0) {
        toastLog ( "normal end" );
         return 0 ;
    } else if (isSuccess === -1) {
        toastLog ( "abnormal end" );
         return . 1 ;
    }
}


function clickGoBrowse() {
    the Browse the let = text ( "to browse") .findOne (1000 );
     IF (! the Browse = null ) {
        guessYouLike the let = textContains ( "guess you like" ) .findOnce ();
         IF (! guessYouLike = null ) {
            console.log ( "appear guess you like" );
            let pp = browse.parent.bounds().top;
            let ppp = guessYouLike.parent.parent.bounds().top;
            if (ppp === pp) {
                console.log ( "Skip - guess you like" );
                let allBrowse = text("去浏览").find();
                for (let i = 0; i < allBrowse.length; i++) {
                    let item = allBrowse[i];
                    if (item.bounds().top !== browse.bounds().top) {
                        browse = item;
                    }
                }
            }
        }

        console.log ( "click - to browse" );
        clickItemInCenter(browse);
        return 1;
    }
    return -1;
}

function runGoBrowse() {
    let isSuccess = 1;

    for (let i = 0; i < 40; i++) {
        isSuccess = ensureOpenBeginning(1000);
        if (isSuccess !== 1) break;

        for (let j = 0; j < 3; j++) {
            isSuccess = clickGoBrowse();
            if (isSuccess !== 1) {
                reopenAgain();
            } Else  break ;
        }

        if (isSuccess === -1) break;

        let jw = judgeWay();

        sleep(1000);
        if (jw === 0) swipeUp();
        else if (jw === -1) {
            if (isFull() === 1) {
                console.log ( "reached the limit" );
                back();
                sleep(2000);
                reopenAgain();
                continue;
            }
            console.log("4s");
            sleep(1000 * 4);
        }
        console.log("15s");
        sleep(1000 * 15);


        let isF = browseFinish();
        if (isF === 0) {
            console.log ( "browse ends and returns" );
        } Else  if (ISF === -1 ) {
            console.log ( "browser did not end normally, return" );
        }

        back();
        sleep(2000);
    }
}

function removeFile(fileName) {
    if (files.exists(fileName)) {
        files.remove(fileName);
    }
}

function clearNewScript() {
    threads.start(function () {
        RemoveFile ( "/ sdcard / script / Taobao meow currency /script.js" );
        RemoveFile ( "/ sdcard / script / Taobao meow currency /version.txt" );
        toastLog ( "clear complete" );
    });
}


function warning(n) {
    items the let = [ "is not updated, but still try the new script (not guaranteed to)", "Clear Local downloaded new script, use the default script", "Click here to download the new APP" ];

    CH the let = dialogs.select ( "the current version does not apply to this new old APP, please update to the new APP.", items, function (index) {

        if (index >= 0) {

            if (index === 0) {

                threads.start(function () {
                    sleep(1000);
                    runRun (n);
                });

            } else if (index === 1) {
                clearNewScript();
            } else if (index === 2) {
                Alert ( "Where can I download old APP go where to download the new APP, I had no desire to release" );
            }
        }
    });
}

function runRun(n) {
    sleep(500);

    let statue = runGoBrowse();
    toastLog ( "to browse - browse End" );
    Alert ( "End" );
}

function moveFloating(n) {
    let i = -1;
    dialogs.confirm ( "because of the need, move the floating window to move to the left." "Click OK to indicate the completion directly run the script. \ n Click Cancel to go to the manual adjustment. \ n" +
        "(Intermediate browsing process may jump into the Taobao Home to view, at this time need to manually switch back again to shop cat.)", Function (the Clear) {
         IF (the Clear) {
            console.log ( "straight run" );
            i = 1;
        } else {
            toastLog ( "Please move left floating window" );
            i = 0;
        }
    });


    while (i === -1) {
        gouge ( 100 );
    }
    if (i === 1) {
        runRun (n);
    }
}

function runChoose(n) {
    let currentVersion = app.versionCode;
    if (currentVersion === 1) {
        warning(n);
    } else {
        moveFloating(n);
    }
}

module.exports = runChoose;

If you do not understand, then it is a direct download, remember to open the floating window, and then switch to Taobao:

 

 

Complete automatic brush floor it!

 

 

Author: full-stack developer community

For more information on public concern number of full-stack developer community

 

 

Guess you like

Origin www.cnblogs.com/mumu2/p/11831114.html