帮助我看看这段代码
;这里是随机的产生部分
$sousuocisuiji = Random(1, 169, 1);搜索词的随机数
;MsgBox(0, "提示信息:", $sousuocisuiji, 1)
$chuzhanlianjiesuiji = Random(1, 49, 1);出站链接的随机数
;MsgBox(0, "提示信息:", $chuzhanlianjiesuiji, 1)
$sousuoci = FileOpen("搜索词.txt", 0);打开搜索词.txt
$sousuoci = FileReadLine($sousuoci, $sousuocisuiji);读取随机行的文字
;MsgBox(0, "提示信息:", $sousuoci, 1)
$chuzhanlianjie = FileOpen("出站链接.txt", 0);打开出站链接.txt
$chuzhanlianjie = FileReadLine($chuzhanlianjie, $chuzhanlianjiesuiji);读取随机行的文字
;MsgBox(0, "提示信息:", $chuzhanlianjie, 1)
;这里是读取网址连接部分
While 1
$wagnzhi = FileOpen("网址.txt", 0);打开文件,读取网址
If @error = -1 Then ExitLoop
$wagnzhi = FileReadLine($wagnzhi)
;if @error = -1 Then ExitLoop
;MsgBox(0, "提示信息:", $wagnzhi, 1)
;xp系统的主页需要改动
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "REG_SZ", "" & $wagnzhi & "")
#include <IE.au3>;加载函数库
;RunWait(@ComSpec & " /c rasdial 宽带连接 043404550739 nieyiheng529264","", 0);拨号连接宽带
;以下是搜索操作
$oie = _IECreate($wagnzhi, 1);打开网址
$oForm = _IEFormGetObjByName($oie, "bdfm");找到“bdfm”
$oQuery = _IEFormElementGetObjByName($oForm, "word");找到“word”
_IEFormElementSetValue($oQuery, $sousuoci);输入搜索词
$oQuery = _IEFormSubmit($oForm, "0");找按钮
_IEAction($oQuery, "click");点击搜索按钮
Sleep(3986)
;以下是点击文字连接
Local $sMyString = $chuzhanlianjie
Local $oLinks = _IELinkGetCollection($oie)
For $oLink In $oLinks
Local $sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next
;Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe")
Sleep(2000)
ProcessClose("IEXPLORE.exe")
WEnd
代码中的While 1和wend 部分怎么出错呢?如果我想把While 1和wend 部分无限循环,怎么做呢? 本帖最后由 apoorman1986 于 2012-3-30 12:29 编辑
代码写得太乱了,建议自定义函数func和endfunc分离出来!这样清晰明了,出了问题也好判断!{:face (197):} 1楼, 2楼
友情提醒:
发或回复这类标题的帖子都是非正常ACN人士所为(当然本人已被自动排除在外)
页:
[1]