Home > other >  I ask autojs problem
I ask autojs problem

Time:09-29

Auto. WaitFor ();
The function of tencent playful sign in () {
Launch (" iwan.tencent.com ");
Sleep (6000);
//waitForActivity (" android app. The Dialog ");
//waitForActivity (" iwan.tencent.com.MainActivity ");
//the log (" interface to start ");
What day today//var="what day is it today" + "day 123456" charAt (new Date (). GetDay ());//have a judgment whether Monday
What day//log (today);
Var gift bag bearing=className (".. An android widget TextView "). The text (" package "). The findOne (). The parent (). The bounds ();
If (gift bag bearing) {
Click (gift bag. CenterX (), gift bag. CenterY ());
The log (" already click gift bag ");
};
Sleep (2000);
////waitForActivity (" com. Afollestad. Materialdialogs. MaterialDialog ");
Var three wing pass border=className (".. An android widget TextView "). The text (" the inheritance of The Three Kingdoms wing - overlord "). The findOne (). The parent (). The bounds ();
If (the three wing boundary) {
The log (" finding boundary ");
Click (the three wing boundary. CenterX (), the three wing boundary. CenterY ());
};
Sleep (2000);
Var more=className (".. An android widget TextView "), text (" more "). The findOne (). The parent (). The bounds ();
Click (more. CenterX (), and more. CenterY ());
Sleep (2000);
Swipe (550, 1830, 500, 1300, 1000);
Get the var control array=className (".. An android widget TextView "). The text (" get "). The find ();
Var array gotten number=get control. The size ();
The log (" a total of "number + + to receive" a gift bag ");
For (I=0; i Click (receiving control array [I] bounds () centerX (), get the control array [I] bounds () centerY ());
Sleep (2000);
Var determine=className (".. An android widget TextView "). The text (" ok "). The findOne (). The parent (). The bounds ();
Click (sure. CenterX (), sure. CenterY ());
Sleep (2000);
Var determine 2=className (".. An android widget TextView "). The text (" ok "). The findOne (). The parent () bounds ();
Click (sure 2. CenterX (), to determine 2. CenterY ());
Sleep (3000);
}
ToastLog (" complete play tencent love gift bag to receive ");
};
The function point vientiane sign in () {
The log (1);
Launch (" com. Crland. Mixc ");
Sleep (4000);
WaitForActivity (" com. The mixc. Main. Activity. HomeActivity ");
The log (" find main interface ");
Sleep (2000);
Var main industry face to face sign in=className (" TextView "). The text (" sign in per day). The findOne (). The parent ();
To sign in the if (main world) {
The main industry in face to face. Click ();
The log (" click on the main industry to sign in successfully ");
};
Sleep (2000);
//var sign-in controls 1=className (" the View "). The text (" sign in "). The findOne (); Can click the sign-in control click no reaction
Var check-in controls 1=className (" android. View. The view "). The text (" sign in "). The findOne (10000);//the View, alone will not omit the android. In front of the View,
Var has signed in=className (" android. View. The view "). The text (" sign in "). The findOne (10000);
Sleep (2000);
If (1) sign in control {
The log (" find the sign-in control 1 ");
Var sign-in control border=1 sign in control 1. Bounds ();
Click (sign in border controls 1. CenterX (), signed in border controls 1. CenterY ());
Sleep (2000);
Var has signed in 1=className (" android. View. The view "). The text (" sign in "). The findOne (10000);
If (already signed in 1) {
ToastLog (" has been signed in 1 ");//equivalent to toast and log two code
}
}//behind can't add a semicolon
Else if (check-in) {
ToastLog (" sign in ");
}//behind can't add a semicolon
The else {
ToastLog (" not sign in success ");
};
};

Tencent's playful sign in ();
Sleep (500)
Home ();
Sleep (500)
Home ();
Sleep (2000);
Toast (" then run a little host ");
Sleep (2000);
A bit of vientiane sign in ();



Encapsulates the two functions, run separately two functions can be successful, but it looks like after merger, only run the first tencent playful sign in function, and then back to the desktop, the second a little vientiane sign-in function is not running (first of all is to open a little vientiane app in theory, but can't open, keep the desktop, see the log and stop at the end of the first function), a bit of vientiane lannch () this step, there is no execution, excuse me what reason is this?
I hope you give a solution,
  • Related