;这里是随机的产生部分
$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 部分无限循环,怎么做呢? |