#include <IE.au3>
#include <Constants.au3>
#include <Date.au3>
$file = FileOpen("zi.txt", 0)
If $file = -1 Then
MsgBox(0, "错误", "在脚本目录下建立zi.txt的文本文件在写几个汉字")
Exit
EndIf
$sl = 0
While 1
$chars = FileRead($file, 2)
Sleep(1000)
$oIE = _IECreate("http://www.uname.cn/dic/zidian.asp", 1, 1,1,1)
Sleep(1000)
$a = _IEGetObjByName($oIE, "gb")
Sleep(1000)
_IEFormElementSetValue($a, $chars)
Sleep(1000)
$oSubmit = _IEGetObjByName($oIE, "gb")
Sleep(1000)
$b = _IEGetObjByName($oIE, "Submit")
Sleep(1000)
_IEAction($b, "click")
Sleep(1000)
_IELoadWait($oIE)
Sleep(1000)
$sHTML = _IEBodyReadHTML($oIE)
$Link = StringRegExp($sHTML, 'href="(/html/dic/[^"]+)">', 3)
If @error = 0 Then
$s = 'http://www.uname.cn' & $Link[0]
Else
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤5-这将是个错误回馈,而且也会因此停止程序的运行", $s)
EndIf
$oIE2 = _XmlHttp($s)
$sR = StringRegExp($oIE2, '#FFFFFF">(.*?)( )?</td>', 3)
If @error = 0 Then
IniWrite("e1.ini", "Section3", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & "_" & $chars, $sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9])
ElseIf @error <> 0 Then
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤7", $chars & "," & $sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9])
EndIf
$sl = $sl + 1
ToolTip($sR[0] & "," & $sR[2] & "," & $sR[3] & "," & $sR[4] & "," & $sR[6] & "," & $sR[7] & "," & $sR[8] & "," & $sR[9], 50, 50, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "-" & @SEC & @CR & "已经完成了第" & $sl & "个字上一个是" & $chars, 0, 4)
WEnd
Func _XmlHttp($Url) ;Sanhen
Local $oHTTP, $sReturn
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("get", $Url, False)
$oHTTP.Send()
$sReturn = BinaryToString($oHTTP.responseBody)
Return $sReturn
EndFunc ;==>_XmlHttp