#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
Assign("oIE", "0", 2)
$chars = FileRead($file, 2)
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤1", "")
$oIE = _IECreate("http://www.uname.cn/dic/zidian.asp", 0, 0)
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤2", "")
$a = _IEGetObjByName($oIE, "gb")
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤2.1", "")
_IEFormElementSetValue($a, $chars)
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤2.2", "")
$oSubmit = _IEGetObjByName($oIE, "gb")
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤2.3", "")
$b = _IEGetObjByName($oIE, "Submit")
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤2.4", "")
_IEAction($b, "click")
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤3", "")
_IELoadWait($oIE)
$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)
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤6", $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)
_IEQuit($oIE)
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤8", "关闭")
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
IniWrite("e1cw.ini", $chars, @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & " 步骤9", "会不会使这里的问题?")
EndFunc ;==>_XmlHttp
出现这个问题