原始网页
运行VBS以后的效果.
Dim ie, strVal, intKey1, intKey2, bChk
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
''登录URL
ie.navigate "http://xxxxxxxxxxxx.com.cn/Login/Login.aspx"
If Not ie Is Nothing Then
Do While ie.readystate <> 4
If ie Is Nothing Then Exit Do
Loop
End If
'On Error Resume Next
If Not ie Is Nothing Then
'自动登录,由于有图形检验码不能自动完成,
If ie.document.location = "http://xxxxxxxxxxxx.com.cn/Login/Login.aspx" Then
ie.document.All("txtUserName").Value = "username"
ie.document.All("txtPassWord").Value = "password" '密码
ie.document.All("txtCode").Focus '检验码
End If
End If
If Not ie Is Nothing Then
'等待打开带计时器的URL
Do While Left(ie.document.location, 61) <> "http:///xxxxx.xxxxxx.com.cn/xxxxxxxxxxx/xxxxxfrm.aspx?BookID="
If Left(ie.document.location, 61) = "http:///xxxxx.xxxxxx.com.cn/xxxxxxxxxxx/xxxxxfrm.aspx?BookID=" Then
Exit Do
End If
WScript.Sleep 500
If ie Is Nothing Then Exit Do
Loop
End If
'ie.Visible = False
'初始随机值
intKey1 = Int(Second(Now()) / 10) + 10
intKey2 = Second(Now())
bChk = True
Do While Not ie Is Nothing
If Not ie Is Nothing And ie.document.Frames.length > 0 Then
On Error Resume Next
'找到计时器的Frame对应的页面
If Left(ie.document.Frames(0).Frames.document.location, 55) = "http://xxxxx.xxxxxx.com.cn/xxxxxxxxxxx/xxxxxxTime.aspx" Then
On Error GoTo 0
'找到计时页面上的当时时间
strVal = ie.document.Frames(0).Frames.document.All("thzt").Value
If bChk Then
'修改按钮文本,原来是'更新计时'
ie.document.Frames(0).Frames.document.All("update").Value = "监视时长:" & intKey1 & "分" & intKey2 & "秒"
bChk = False
WScript.Sleep 1000*60*intKey1
End If
'If Not ie Is Nothing And Not button Is Nothing And Not ie.document.Frames(0).Frames.document.All("update").disabled Then
If strVal <> "" Then
'时间到
If Left(Trim(strVal),2) > intKey1 Or Trim(strVal) = intKey1 & "分" & intKey2 & "秒" Or _
Trim(strVal) = intKey1 & "分" & intKey2+1 & "秒" Or Trim(strVal) = intKey1 & "分" & intKey2+2 & "秒" Then
'随机值
intKey1 = Int(Rnd(Second(Now())) * 10) + 10
intKey2 = Int(Rnd(Second(Now())) * 60)
'自动点计时按钮
ie.document.Frames(0).Frames.document.All("update").disabled=False
ie.document.Frames(0).Frames.document.All("update").Click
bChk = True
'MsgBox "监视时长:" & intKey1 & "分" & intKey2 & "秒"
End If
End If
'End If
End If
End If
WScript.Sleep 1200
If ie Is Nothing Then Exit Do
Loop