#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$size = FileGetSize (@ScriptFullPath)
Global $url = "http://www.10010.com/getImage.jsp"
Global $jpg = @TempDir&'\tem'&$size&'.jpg'
Global $cdb = @TempDir & '\'&$size&'.tmpb'
Global $dll = @TempDir & '\'&$size&'.tmpl'
FileInstall("Captchio.dll", $dll, 0);解压dll
FileInstall("Captchio.cdb", $cdb, 0);解压特征库
RunWait(@COMSPEC & " /c regsvr32 "& $dll & " /s","",@SW_HIDE);注册dll
download()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("验证码识别", 162, 65, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Pic1 = GUICtrlCreatePic($jpg, 55, 10, 40, 20, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent($Pic1, "Button1Click")
GUICtrlCreateLabel("图像:", 10, 12, 40, 17)
$Button1 = GUICtrlCreateButton("下一个", 100, 10, 56, 46, $WS_GROUP)
GUICtrlSetOnEvent($Button1, "Button1Click")
GUICtrlCreateLabel("识别:", 10, 37, 40, 17)
$Input1 = GUICtrlCreateInput("", 55, 35, 41, 21)
shibie()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Button1Click()
download()
GUICtrlSetImage ($Pic1,$jpg)
shibie()
EndFunc
Func Form1Close()
GUISetState(@SW_SHOW,$Form1)
RunWait(@COMSPEC & " /c regsvr32 "& $dll & " /u /s","",@SW_HIDE)
Exit
EndFunc
Func download()
InetGet ($url,$jpg, 1, 0)
EndFunc
Func shibie()
GUICtrlSetData($Input1, _Dispatch($jpg,$cdb))
EndFunc
Func _Dispatch($jpg,$cdb);自动识别验证码的Func
$obj = ObjCreate("Captchio.cCaptcha")
$obj.OpenCharDB($cdb)
$txt = $obj.GetStringFromFile($jpg, 1)
Return $txt ;返回识别出来的验证码
EndFunc ;==>_Dispatch