|
本帖最后由 sdwd_lhq 于 2011-9-13 11:10 编辑
阿福的验证码识别中的CodeFont.txt文件是从哪来的?如下:
$a_Image = myReadImageToArray($img, True, 1, 0xeeeeee)
$s_code_string = myArrarOCR(@ScriptDir & "\CodeFont.txt", $a_Image, 1, 4, 5, "", 0, 5, 0, 0)
程序全代码如下(参看lynfr8师兄的代码):#include <IE.au3>
#include <Ocr.au3>
#Include <Clipboard.au3>
#Include <ScreenCapture.au3>
Dim $i=0
$oIE = _IECreate ("http://www.ys168.com/ht/login.aspx")
$sHTML = _IEBodyReadHTML ($oIE)
$array = StringRegExp($sHTML, '/ht/sjzx/ys_vf_img.aspx\?lx=htdl&sj=(.*?:\d{1,2}:\d{1,2})', 3)
$User = _IEGetObjByName($oIE,"dl1")
$User.value = "autoittest"
$PW = _IEGetObjByName($oIE,"dl2")
$PW.value = "autoittest"
$oImgs = _IEImgGetCollection ($oIE)
For $oImg In $oImgs
$i+=1
If $oImg.src="http://www.ys168.com/ht/sjzx/ys_vf_img.aspx?lx=htdl&sj="&$array[0] Then
$oPic = $oIE.Document.body.createControlRange()
$oPic.Add($oImg)
$oPic.execCommand("Copy")
$img = ClipGet()
_ClipBoard_Open (0)
Local $hMemory = _ClipBoard_GetDataEx ($CF_BITMAP)
_ClipBoard_Close ()
FileDelete(@ScriptDir & "\ys168temp.bmp")
_ScreenCapture_SaveImage (@ScriptDir & "\ys168temp.bmp", $hMemory)
EndIf
Next
$a_Image = myReadImageToArray(@ScriptDir & "\ys168temp.bmp", False, 1, 0x777777)
$s_code_string = myArrarOCR(@ScriptDir&"\ys168CodeFont.txt", $a_Image, 1, 4, 8, "", 5, 1, 4, 5)
$Code = _IEGetObjByName($oIE,"dl3")
$Code.value = $s_code_string
$Login = _IEGetObjByName($oIE, "bu1")
$Login.click
|
|