无纸化学法用及考试系统(自动登陆及自动答题脚本

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

无纸化学法用及考试系统(自动登陆及自动答题脚本)

一、自动登陆源码:

说明:这个没什么好说的,查找网页元素的ID号,根据ID号填表。

On Error Resume Next

s = WebBrowser1.hwnd

If s > 0 Then ny = MsgBox("如果你没有“提交试卷”,请选择“否”。否则,你会没有成绩。" & Chr(13) + Chr(10) & "请提交试卷后再退出本软件!", vbQuestion + vbYesNo, "请提交试卷后再退出本软件")

If ny = vbNo Then

SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设置窗口总在最前面

Else

WebBrowser1.Quit

Set ie = Nothing

xlBook.Close (True)

xlApp.Quit

Set xlApp = Nothing

Set dm = Nothing

Unload Me

End If

End Sub

Private Sub Command1_Click()

On Error Resume Next '错了断续

'dm.CaptureGif 0, 300, 640, 780, "ss.gif", 100, 20000

If tID.Text <> "" Then

'Set ie = GetObject("", "InternetExplorer.Application")

WebBrowser1.Navigate Text1.Text '打开文本框中的网址

'webbrowser1.WindowState = 1

Do Until WebBrowser1.ReadyState = 4 '循环直到网址装载完毕

DoEvents

j = j + 1

If j > 65530 Then

MsgBox "打开无纸学法用法考试网址失败,请联系管理员。"

Exit Sub

End If

Loop

Delay 500

WebBrowser1.Document.All("type2").Click '单击选择“普法考试平台”

Delay 200

WebBrowser1.Document.All("name").Value = tID.Text '输入登陆用户名

WebBrowser1.Document.All("password").Value = "888888" '输入登陆密码

Delay 100

WebBrowser1.Document.All.Tags("INPUT")(3).Click '单击“登陆”

Delay 500

Call InExam '输入正确,进入下一步

Else

MsgBox "请输入你的登陆账号!"

tID.SetFocus

End If

SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设置窗口总在最前面

Private Function InExam()

On Error Resume Next

dm_ret = dm.FindStr(0, 0, 800, 700, "进入考试", "000000-000000", 1#, intX, intY)

If intX >= 0 And intY >= 0 Then

SetCursorPos intX, intY

mouse_event &H2 Or &H4, 0, 0, 0, 0

Else

MsgBox "现在不是考试时间,请联系管理员。"

End If

SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设置窗口总在最前面

Delay 800

dm_ret = dm.FindStr(200, 100, 1024, 800, "开始考试", "006699-000000", 1#, intX, intY) If intX >= 0 And intY >= 0 Then

SetCursorPos intX, intY

mouse_event &H2 Or &H4, 0, 0, 0, 0

End If

dm_ret = dm.SetDict(0, "Song10.txt")

Delay 800

dm_ret = dm.FindStr(0, 0, 1024, 600, "确定", "000000-000000", 1#, intX, intY)

If intX >= 0 And intY >= 0 Then

SetCursorPos intX + 5, intY + 5

mouse_event &H2 Or &H4, 0, 0, 0, 0

End If

Delay 800

End Function

二、进入考试中心后,接下来就是自动答题了。

说明:1、将题目内容与题库内的题比较,在题库中找到题目后,然后将试卷中正确答案前的选择框选择上。(不知道这样说清楚了没有?还是看下面的视频吧)

endFcomp = 0

SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设置窗口总在最前面

dm_ret = dm.SetDict(0, "Song9.txt")

eDict 0

ss:

For Cnt = 1 To 400

If GetAsyncKeyState(vbKeyEscape) Then Exit For

If endF = 17 And Fag = 2 Then

WebBrowser1.Document.parentwindow.scrollby 0, 100

Delay 10

dm.WheelDown

Delay 500

Label2.Caption = "正在完成判断题的第:18题。"

dm_ret = dm.FindStr(30, 50, 800, 600, "18题", "ff3300-000000", 1#, intX, intY)

If intX >= 0 And intY >= 0 Then

s = dm.Ocr(intX + 10, intY - 3, intX + 700, intY + 15, "000000-000000", 1#)

s = Left(s, Len(s) - 5)

Call anser2(s, intX + 25, intY)

End If

WebBrowser1.Document.parentwindow.scrollby 0, 200

dm.WheelDown

Delay 500

Label2.Caption = "正在完成判断题的第:19题。"

dm_ret = dm.FindStr(30, 50, 800, 700, "19题", "ff3300-000000", 1#, intX, intY)

相关文档
最新文档