thing

Import "shanhai.lua"
Dim currHour,currMinute,currSecond
Dim mmRnd = 0
Dim sumFor=Int(ReadUIConfig("sumFor"))
Dim waitTime=Int(ReadUIConfig("waitTime"))//单位秒

If sumFor = 0 Then
sumFor = 3
End If

If waitTime = 0 Then
waitTime = 39
End If

Dim satu = ReadUIConfig("satu")
Dim sund = ReadUIConfig("sund")

Dim cardhh = ReadUIConfig("cardhh")
Dim cardmm = ReadUIConfig("cardmm")

Dim = w_cardhh ReadUIConfig ( "w_cardhh ')
dim w_cardmm = ReadUIConfig (" w_cardmm')
dim dingshijiancha = 0
dim sbTimeH = 7
dim sbTimeM = 17
dim xbTimeH = 17
dim xbTimeM = 30

Int = sbTimeH (cardhh)
sbTimeM = Int (cardmm)
the If sbTimeH = 0 the Then
sbTimeH = DateTime.Hour ()
End the If
the If sbTimeM = 0 the Then
sbTimeM = DateTime.Minute () +1
End the If
outPrint "is expected to trigger the first time:" CStr & (sbTimeH) & ":" & CStr (sbTimeM)
Delay 1000

Int = xbTimeH (w_cardhh)
xbTimeM = Int (w_cardmm)
the If xbTimeH = 0 the Then
xbTimeH = DateTime.Hour ()
End the If
the If xbTimeM = 0 the Then
xbTimeM = DateTime.Minute () +1
End the If
outPrint "is expected to trigger a second time : "& CStr (xbTimeH) &": "& CStr (xbTimeM)
Delay 1000

Dim isCard = 0 // 0 not punch, punch greater than 0 but less than 10

Dim intX, intY, times // find pictures tagged using
Dim cardTagSendMail = 0
Dim cardExec = 0

Log.Open // Open Log

While True
Dim p = CatchTouchPoint(1)
ShowMessage p[1][1]
Dim currWeek = DateTime.WeekDay()
currHour = DateTime.Hour()
currMinute = DateTime.Minute()
currSecond= DateTime.Second()
Dim hm= CSTR(currHour) & ":" & CSTR(currMinute)&":"& CSTR(currSecond)
If currSecond = 59 or currSecond = 30 Then
ShowMessage "当前时间:" & hm
End If

If currHour = 22 and currMinute = 10 and dingshijiancha = 0 Then
setMMRnd (3)
sbTimeM = sbTimeM + mmRnd
Device.Lock
Device.UnLock
dingshijiancha = 1
Delay 600
sendEmail "延后分钟:" & CStr(mmRnd) & " 服务还在:" & CStr(DateTime.Hour()) & ":" & CStr(DateTime.Minute())
Device.Lock
End If

//处理星期6 7 情况,weekTag 0为false 1为true
Dim weekTag = 0
If currWeek = 6 and satu Then
weekTag= 1
End If

If currWeek = 7 and sund Then
weekTag= 1
End If

If currWeek >= 1 and currWeek <= 5 Then
weekTag= 1
End If

If weekTag=1 and ((currHour = sbTimeH and currMinute = sbTimeM) or (currHour = xbTimeH and currMinute = xbTimeM)) Then
If isCard = 0 Then
sbTimeM = sbTimeM - mmRnd
mmRnd = 0
isCard = sumFor//反复开启应用n次
End If
End If

IsCard the while> 0
Device.Lock
Device.UnLock
killDD
Delay 200 is
openDD

outPrint "isCard:" & isCard
the If = sumFor isCard the Then
the sendEmail "Start," & CStr (DateTime.Hour () ) & ":" & CStr (DateTime.Minute ())
End the If

searchTag

the If the Then isCard. 1 // = the last cycle when the lock screen
cardTagSendMail = 0 // mark punch out, so many times the sendEmail
dingshijiancha = 0 // Timing 5:10 23:30
cardExec = 0 / / detect no successful punch mark
sendEmail CStr (sumFor) & "inspections completed," the CStr & (DateTime.Hour ()) & ":" & the CStr (DateTime.Minute ())
Delay 20 is 1000 *
killDD
Device.Lock()
End If

isCard = isCard-1
Delay 1000 * waitTime
Wend

If (currHour=11 or currHour=15 or currHour=16 or currHour=17 or currHour=20 or currHour=4) and currMinute = 50 Then
Device.Lock
Device.UnLock
Delay 1000 * 30
sendEmail "服务还在:"& CStr(DateTime.Hour()) & ":" & CStr(DateTime.Minute())
Delay 1000 * 30
Device.Lock
End If
Wend

Function openDD
RunApp "com.alibaba.android.rimet"
End Function
Function killDD
KillApp "com.alibaba.android.rimet"
End Function

SetMMRnd Function (max)
the Randomize
mmRnd = Int (((max - + 0. 1) * the Rnd ()) + 0)
the ShowMessage "extend rearwardly minutes:" & the CStr (mmRnd)
End Function

Sub searchTag
/*
times = 0
FindPic 0, 0, 16959, 16959, "Attachment:my.png", "000000", 0, 0.8, intX, intY
While intX = -1 And intY = -1 and times < 5
FindPic 0, 0, 16959, 16959, "Attachment:my.png", "000000", 0, 0.8, intX, intY
If intX > -1 And intY > -1 Then
Exit While
End If
Delay 5000
times = times + 1
Wend

times = 0
FindPic 0, 0, 16959, 16959, "Attachment:search.png", "000000", 0, 0.8, intX, intY
While intX = -1 And intY = -1 and times < 5
FindPic 0, 0, 16959, 16959, "Attachment:search.png", "000000", 0, 0.8, intX, intY
If intX > -1 And intY > -1 Then
Exit While
End If
Delay 5000
times = times + 1
Wend
*/
times = 0
FindPic 0, 0, 16959, 16959, "Attachment:gs.png", "000000", 0, 0.8, intX, intY
While intX >= -1 And intY >= -1 and times < 11
FindPic 0, 0, 16959, 16959, "Attachment:gs.png", "000000", 0, 0.8, intX, intY
If intX > -1 And intY > -1 Then
Tap intX, intY
Exit While
End If
Delay 6000
times = times + 1
Wend

times = 0
FindPic 0, 0, 16959, 16959, "Attachment:card.png", "000000", 0, 0.8, intX, intY
While intX >= -1 And intY >= -1 and times < 11
FindPic 0, 0, 16959, 16959, "Attachment:card.png", "000000", 0, 0.8, intX, intY
If intX > -1 And intY > -1 Then
Tap intX, intY
Exit While
End If
Delay 6000
times = times + 1
Wend

///*//上午打卡
If DateTime.Hour() < 13 and cardTagSendMail = 0 Then
cardTagSendMail=1
times = 0

sbxb_Suc "sb"
End If
//*/

///*下午打卡
If DateTime.Hour() > 13 and cardTagSendMail = 0 Then
cardTagSendMail=1
times = 0

sbxb_Suc "xb"
End If
//*/

End Sub

Sub sbxb_Suc(name)
FindPic 0, 0, 16959, 16959, "Attachment:" & name & "_success.png", "000000", 0, 0.8, intX, intY
While intX >= -1 And intY >= -1 and times < 11
FindPic 0, 0, 16959, 16959, "Attachment:" & name & "_success.png", "000000", 0, 0.8, intX, intY
If intX > -1 And intY > -1 Then
cardExec = 1
ShowMessage name & "已经打过卡"
sendEmail name & "打卡成功:" & CStr(DateTime.Hour()) & ":" & CStr(DateTime.Minute())
Exit While
End If
Delay 4000
times = times + 1
Wend

If cardExec = 0 Then
//FindStr(0,0,2000,2000,"长安","9f2e3f-000000",1.0,intX,intY)
//FindPic 0, 0, 16959, 16959, "Attachment:" & name & "_exec.png", "000000", 0, 0.8, intX, intY
Dim n="上班打卡"
If name = "xb" Then
n="下班打卡"
End If
FindStr 0, 0, 16959, 16959, n, "9f2e3f-000000", 1.0, intX, intY
While intX >= -1 And intY >= -1 and times < 8
//FindPic 0, 0, 16959, 16959, "Attachment:" & name & "_exec.png", "000000", 0, 0.8, intX, intY
FindStr 0, 0, 16959, 16959, n, "9f2e3f-000000", 1.0, intX, intY
If intX > -1 And intY > -1 Then
Delay 1000*10
Tap intX, intY
ShowMessage "执行打卡成功"
sendEmail name & "打卡成功:" & CStr(DateTime.Hour()) & ":" & CStr(DateTime.Minute())
Exit While
End If
Delay 4000
times = times + 1
Wend
End If
End Sub

The sendEmail Sub (MSG)
the For 3 'fixed cycle 3 times out
Dim = Server "smtp.qq.com"
Dim = Send "[email protected]"
Dim Pass = "ddvalizklnsubggg"
Dim title = "Card"
Dim Content = MSG
Dim = address "[email protected]"
Dim RET = SendSimpleEmail (Server, the send, Pass, title, Content, address)
the If RET = True the Then
outPrint "Mail sent successfully"
Exit the For
Else
outPrint "Mail failed to send"
End the If
the Next
End Sub

Sub outPrint(msg)
TracePrint msg
ShowMessage msg
Delay 30
End Sub

Guess you like

Origin www.cnblogs.com/zzq-include/p/10988383.html