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

sbTimeH = Int(cardhh)
sbTimeM = Int(cardmm)
If sbTimeH = 0 Then
sbTimeH = DateTime.Hour()
End If
If sbTimeM = 0 Then
sbTimeM = DateTime.Minute() +1
End If
outPrint "预计首次触发时间:" & CStr(sbTimeH) & ":" & CStr(sbTimeM)
Delay 1000

xbTimeH = Int(w_cardhh)
xbTimeM = Int(w_cardmm)
If xbTimeH = 0 Then
xbTimeH = DateTime.Hour()
End If
If xbTimeM = 0 Then
xbTimeM = DateTime.Minute() +1
End If
outPrint "预计第二次触发时间:" & CStr(xbTimeH) & ":" & CStr(xbTimeM)
Delay 1000

Dim isCard=0//不打卡0,打卡大于0小于10

Dim intX, intY,times//寻找图片标记使用
Dim cardTagSendMail=0
dim cardExec=0

Log.Open //打开日志

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

While isCard > 0
Device.Lock
Device.UnLock
killDD
Delay 200
openDD

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

searchTag

If isCard = 1 Then //最后一次循环的时候锁屏
cardTagSendMail = 0//上下班打卡标记,免得多次sendEmail
dingshijiancha = 0//定时23:30 5:10
cardExec = 0//检测有没有打卡成功的标记
sendEmail CStr(sumFor) & "次检查完毕,"& CStr(DateTime.Hour()) & ":" & CStr(DateTime.Minute())
Delay 1000 * 20
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

Function setMMRnd(max)
Randomize
mmRnd = Int(((max - 0 + 1) * Rnd()) + 0)
ShowMessage "向后延长分钟数:" & 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

Sub sendEmail(msg)
For 3 '固定循环3次跳出
Dim server ="smtp.qq.com"
Dim send = "472708969@qq.com"
Dim pass = "ddvalizklnsubggg"
Dim title = "card"
Dim content = msg
Dim address = "472708969@qq.com"
Dim ret = SendSimpleEmail(server,send,pass,title,content,address)
If ret = True Then
outPrint "邮件发送成功"
Exit For
Else
outPrint "邮件发送失败"
End If
Next
End Sub

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

ding的更多相关文章

  1. <转载> GIT 操作小结 http://www.cnblogs.com/-ding/p/6008096.html

    参考: http://www.cnblogs.com/zyf-zhaoyafei/p/4486220.html 作者:万境绝尘 转载请注明出处:http://blog.csdn.net/shulian ...

  2. obs nginx-rtmp-module搭建流媒体服务器实现直播 ding

    接下来我就简单跟大家介绍一下利用nginx来搭建流媒体服务器. 我选择的是腾讯云服务器 1.下载nginx-rtmp-module: nginx-rtmp-module的官方github地址:http ...

  3. 【C#公共帮助类】 Utils 10年代码,最全的系统帮助类

    为大家分享一下个人的一个Utils系统帮助类,可能有些现在有新的技术替代,自行修改哈~ 这个帮助类主要包含:对象转换处理 .分割字符串.截取字符串.删除最后结尾的一个逗号. 删除最后结尾的指定字符后的 ...

  4. php 基础代码大全(不断完善中)

    下面是基础的PHP的代码,不断完善中~ //语法错误(syntax error)在语法分析阶段,源代码并未被执行,故不会有任何输出. /* [命名规则] */ 常量名 类常量建议全大写,单词间用下划线 ...

  5. ContentProvider域名替换小工具

    开发项目域名想怎么换就怎么换,就是这么任性! 这是一个很有意思的小工具! 这是一个方便开发人员和测试人员的小工具!! 吐槽: 一直在做Android开发,一直总有一个问题存在:做自己公司的apk开发时 ...

  6. Oracle 内置sql函数大全

    F.1字符函数--返回字符值 这些函数全都接收的是字符族类型的参数(CHR除外)并且返回字符值.除了特别说明的之外,这些函数大部分返回VARCHAR2类型的数值.字符函数的返回类型所受的限制和基本数据 ...

  7. 【转】漫谈iOS程序的证书和签名机制

    转自:漫谈iOS程序的证书和签名机制 接触iOS开发半年,曾经也被这个主题坑的摸不着头脑,也在淘宝上买过企业证书签名这些服务,有大神都做了一个全自动的发布打包(不过此大神现在不卖企业证书了),甚是羡慕 ...

  8. Oracle汉字转拼音package

    --函数GetHzFullPY(string)用于获取汉字字符串的拼音 --select GetHzFullPY('中华人民共和国') from dual; --返回:ZhongHuaRenMinGo ...

  9. spool命令

    最近工作中,需对数据进行比对.在此之前,则需将数据导出.想到以前用过的spool命令,实验一番,分享如下: 需建SQL执行脚本,内容如下: set feedback off   --关掉行数显示set ...

随机推荐

  1. Java 读写文件示例

    import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; public class T ...

  2. 膜态沸腾UDF【转载】

    膜态沸腾的UDF,添加注释.其中获取VOF梯度的方法详见前面的日志,其中很多宏无法通过UDF手册查阅, 蒸汽相中的质量源项的一般形式为: 式中: 通过一阶近似,热流之差可表达为: 式中: 通过此近似, ...

  3. 在Ubuntu 18.04 下安装mysql,没有初始密码,重设root密码

    在Ubuntu 18.04 下安装mysql 不知道是由于mysql更新为新版还是.Ubuntu18.04中的特性,安装过程中没有设置密码的环节,在网络上找了半天,总算解决了!特此记录下来,以便以后查 ...

  4. git提交报错:Updates were rejected because the tip of your current branch is behind

    提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...

  5. Java 面向对象(十五)

    Lambda表达式 1. 函数式编程思想概述 在数学中,函数就是有输入量.输出量的一套计算方案,也就是"拿什么东西做什么事情".相对而言,面向对象过分强调"必须通过对象的 ...

  6. html5中hgroup和address标签使用总结

    html5中hgroup和address标签使用总结 一.总结 一句话总结: hgroup元素(不推荐使用):用来给标题分组,通常放在header中: address元素:斜体显示:用来说明作者的联系 ...

  7. 类别不平衡问题之SMOTE算法(Python imblearn极简实现)

    类别不平衡问题类别不平衡问题,顾名思义,即数据集中存在某一类样本,其数量远多于或远少于其他类样本,从而导致一些机器学习模型失效的问题.例如逻辑回归即不适合处理类别不平衡问题,例如逻辑回归在欺诈检测问题 ...

  8. U盘量产过程PS2251-07(PS2307) - F/W 01.05.10 [2014-05-23]

    说明本篇文章可能无法解决你的问题,请谨慎尝试.本博客中使用的工具提供下载(如果没有积分,可联系作者免费获取)ChipGenius_v4_00_0030UPTool_v2.089起因 U盘原先正常使用, ...

  9. Phpstudy 无法启动mysql

    原因: 两个mysql版本冲突 本地已经有一个mysql服务(3306)默认开启,再装了phpstudy又会自带一个mysqlla服务(3306) phpstudy启动后会启动mysqlla  发现3 ...

  10. cv2.imread()

    cv2.imread() 使用opencv和caffe的伙伴们,可能会有一个疑问,那就是对于同时读取图片的cv2.imread()和caffe.io.loadimage两个函数,有什么差别? 1.cv ...