;~ #include <CoProc.au3>
#include <ie.au3>
#include <Clipboard.au3>
#include <ScreenCapture.au3>
;修改注册表主要是不让IE弹出访问剪贴板的对话框
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", "1407", "REG_DWORD", "00000000")
login()
Sleep(2000)
Func login()
Local $j =1
;Local $cookiedir = "C:\Documents and Settings\cookie" & Chr(Random(97, 122, 1)) & @SEC & Random(1, 10000000) & Chr(Random(97, 122, 1)) & Chr(Random(65, 90, 1))
;RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Cookies", "REG_EXPAND_SZ", $cookiedir)
Local $gv_RandomCode = IniRead(@ScriptDir & "\UserData.ini", "User" & $j, "用户名", "")
Local $oIE = _IECreate("http://reg.fmmukq.com/passport/Index.aspx", 0, 1, 1, 0)
Local $oForm = _IEFormGetObjByName($oIE, "formLogin")
Local $oQuery = _IEFormElementGetObjByName($oForm, "selLoginType")
_IEFormElementOptionSelect($oQuery, "0", 1, "byValue")
$oQuery = _IEFormElementGetObjByName($oForm, "txtLoginName")
_IEFormElementSetValue($oQuery, $gv_RandomCode)
$oQuery = _IEFormElementGetObjByName($oForm, "txtLoginPwd")
_IEFormElementSetValue($oQuery, $gv_RandomCode)
Dim $i = 0
Local $oImgs = _IEImgGetCollection($oIE)
For $oImg In $oImgs
$i += 1
If $oImg.src = "http://reg.fmmukq.com/modules/verifyImage.ashx" Then
Local $oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.execCommand("Copy")
Local $img = ClipGet()
_ClipBoard_Open(0)
Local $hMemory = _ClipBoard_GetDataEx($CF_BITMAP)
_ClipBoard_Close()
FileDelete(@ScriptDir & "\verifypic1.bmp")
_ScreenCapture_SaveImage(@ScriptDir & "\verifypic1.bmp", $hMemory)
EndIf
Next
Local $AntiDll = DllOpen("AntiVC.dll") ;识别的dll路径
Local $LocalCDS = @ScriptDir & "\fmmukq.cds";识别库的路径
Local $index = DllCall($AntiDll, "long", "LoadCdsFromFile", "str", $LocalCDS)
If $index[0] = -1 Then
MsgBox(0, "错误", "识别库不存在或者打不开")
Exit
EndIf
Local $CdsResult = DllCall($AntiDll, "int", "GetVcodeFromFile", "int", $index[0], "str", @ScriptDir & "\verifypic1.bmp", "str", 0)
If $CdsResult[0] = -1 Then
MsgBox(0, "错误", "识别验证码失败")
Exit
EndIf
DllClose($AntiDll)
$oQuery = _IEFormElementGetObjByName($oForm, "txtCheckCode")
_IEFormElementSetValue($oQuery, $CdsResult[3])
$oIE.document.parentWindow.execscript("Passport.doLogin()")
Sleep(3000)
Local $Ele = _IETagNameGetCollection($oIE, "DIV", 2)
If $Ele <> 0 And StringInStr($Ele.innertext, "欢迎来到口腔医院预约挂号网") Then
_IENavigate($oIE, "http://reg.fmmukq.com/Doctor/Index.aspx?id=6101002010223010")
Exit
EndIf
EndFunc ;==>login