Home > Back-end >  Nailing cracked 5.1.8 version of the script (based on auto. Js) development
Nailing cracked 5.1.8 version of the script (based on auto. Js) development

Time:09-18

//double threads to execute 3
for (i=0; i <3; I++) {
Threads. Start (function () {//thread 1 - main program
Do_main ();
});
Sleep (4 * 60 * 1000);//thread 2 -- the dead cycle time
Threads. ShutDownAll ();
The log (" dead cycle time to proof, end all process ");
}



//main program
The function do_main () {
Var now_time=new Date ();
Var now_hours=now_time. GetHours ()
Auto. WaitFor (" fast ");//check the barrier-free access start
Bright_screen ();
Sleep (500);
//unlock_screen ();//only support android & gt;=7.0
Sleep (500);
Stop_app ();
Sleep (500);
Is_login ();
Sleep (500);
In_kaoqin ();
Sleep (500);
If (now_hours & lt;=12) {//less than or equal to 12 points to punch in
Do_clock_in ();
Sleep (500);
} else {
Do_clock_out ()
Sleep (500);
}
Device. CancelKeepingAwake ();
The log (", the main program has been completed to cancel the equipment normally on ");
}

//subroutine:
//1. The bright screen//bright_screen ()
//2. Unlock//unlock_screen ()
//3. End of nailing//stop_app ()
4//login//is_login ()
////5. Enter the attendance page in_kaoqin ()
//6. Punch in//do_clock_in ()
//7. Punch out//do_clock_out ()


Light screen
//1.The function bright_screen () {
The log (" into the bright screen subroutine ")
Device. WakeUpIfNeeded ();//wake up equipment
Device. KeepScreenOn ();//keep bright screen
The log (" awaken ");
if (! Device. IsScreenOn ()) {
The log (" not awaken ");
Device. WakeUpIfNeeded ();
Bright_screen ();
}
}

//2. Unlock - android 7.0 and above to support gesture and coordinate operations
The function unlock_screen () {
The log (" enter the unlock subroutines ");
Swipe (X1, Y1, X2, Y2, 1000);//struck out gesture interface
Sleep (1000);
Gesture (1000, [X1, Y1], [X2, Y2], [X2, Y3]);//gesture unlock
Sleep (1000);
Home ();
Sleep (500);
}

//3. End of nailing process, make sure start nailing last in main page
The function stop_app () {
The log (" end into the process of nailing subroutines ");
App. OpenAppSetting (" com. Alibaba. Android. Rimet ");//into the nail set
The text (app. GetAppName (" com. Alibaba. Android. Rimet ")). The waitFor ();
Let is_sure=textMatches (/(mandatory. * |. * stop | forcibly. *)/). The clickable (true). The findOne ();
If (is_sure enabled ()) {
Sleep (1000);
TextMatches (/(mandatory. * |. Stop | *. *. *)/). The clickable (true). The findOne (). Click ();
Sleep (1000);
TextMatches (/(mandatory. * |. Stop | *. *. *)/). The clickable (true). The findOne (). Click ();
The log (app. GetAppName (" com. Alibaba. Android. Rimet ") + "application had been closed down");
Sleep (500);
Home ();
} else {
The log (app. GetAppName (" com. Alibaba. Android. Rimet ") + "applications can't be normally closed, try again");
Sleep (500);
Home ();
}
}



//4. Determine whether the unknown part of the need to manually modify the code
The function is_login () {
The log (" enter login decision subroutine ");
App. LaunchPackage (" com. Alibaba. Android. Rimet ");
Sleep (7000);
If (id (" et_pwd_login "). The exists ()) {//determine whether in the login page
Var mobile number=id (" et_phone_input "). The findOne ();
Mobile phone number. The setText (" please enter the login name ");
Var password=id (" et_pwd_login "). The findOne ();
Sleep (1000);
Password. SetText (" please enter the password ");
Id (" btn_next "). The findOne (). Click ();
Info="account not login & gt;> Have login succeeds "
The log (info)
} else {
If (className (" android. Widget. RelativeLayout "). The exists ()) {
The log (" account login ")
Sleep (500);
} else {
The log (" not detected nailing activities page & gt;> Restart the nailing ")
Is_login ();
}
}
}
//5. Enter the attendance page
The function in_kaoqin () {
The log (" enter the attendance page switching subroutine ")
if (null !=textMatches (" table "). The clickable (true). The findOne (3000)) {
Toast (find the workbench button "text")
Anniu_gongzou=textMatches (/. * workbench. *)/). FindOnce ()
The log (" found in the text the workbench button ")
Sleep (500);
Anniu_gongzou. Click ();
Sleep (6000);
if (null !=textMatches (" attendance clock "). The clickable (true). The findOne (3000)) {
Toast (find the attendance clock button "text")
Anniu_kaoqin=textMatches (/. * attendance clock. *)/). The findOne ()
The log (" text found in attendance button ")
Sleep (500)
Anniu_kaoqin. Click ();
Sleep (5000);
The log (" enter the page of clock ");
} else {
if (null !=descMatches (" attendance clock "). The clickable (true). The findOne (3000)) {
Toast (find the attendance clock button "desc")
Anniu_kaoqin=descMatches (/. * attendance clock. *)/). The findOne ()
The log (" found in desc attendance button ")
Sleep (500)
Anniu_kaoqin. Click ();
Sleep (5000);
The log (" enter the page of clock ");
} else {
Sleep (500)
The log (" did not enter the page of clock ");
Sleep (500);
In_kaoqin ();
}
}
}
if (null !=descMatches (" table "). The clickable (true). The findOne (3000)) {
Toast (find the workbench button "desc")
Anniu_gongzou=descMatches (/. * workbench. *)/). FindOnce ()
The log (" found in desc workbench button ")
Sleep (500);
Anniu_gongzou. Click ();
Sleep (6000);
if (null !=textMatches (" attendance clock "). The clickable (true). The findOne (3000)) {
Toast (find the attendance clock button "text")
Anniu_kaoqin=textMatches (/. * attendance clock. *)/). The findOne ()
The log (" text found in attendance button ")
Sleep (500)
Anniu_kaoqin. Click ();
Sleep (5000);
The log (" enter the page of clock ");
} else {
if (null !=descMatches (" attendance clock "). The clickable (true). The findOne (3000)) {
Toast (find the attendance clock button "desc")
Anniu_kaoqin=descMatches (/. * attendance clock. *)/). The findOne ()
The log (" found in desc attendance button ")
Sleep (500)
Anniu_kaoqin. Click ();
Sleep (5000);
The log (" enter the page of clock ");
} else {
Sleep (500)
The log (" did not enter the page of clock ");
Sleep (500);
In_kaoqin ();
}
}
}
}
//6. Clock
The function do_clock_in () {
The log (" to play a clip into the work program ")
if (null !=descMatches (" punch in "). The findOne (1000)) {
Toast (find the clock button "desc")
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related