当$asResult不是数组(没有匹配到符合正则的字符串)时就会出现这样的情况,加个If IsArray($asResult) Then来判断下呗Dim $randoms, $asResult
Randomd()
Func Randomd()
InetGet("http://tv.tudou.com/albumtop/top/listRank.html?cid=30&type=0", @TempDir & "\2.html", 1, 1)
$sString = FileRead(@TempDir & "\2.html")
$sRegExp = 'target="new">[^<]+</a></div></td>'
$asResult = StringRegExp($sString, $sRegExp, 3)
If IsArray($asResult) Then
For $i = 0 To UBound($asResult) - 1 Step 1
$asResult[$i] = StringMid($asResult[$i], StringInStr($asResult[$i], '>') + 1, StringInStr($asResult[$i], '<') - StringInStr($asResult[$i], '>') - 1)
Next
$randoms = Random(1, UBound($asResult), 1)
EndIf
;MsgBox(4096, "Program files are in:", $asResult[$randoms])
EndFunc ;==>Randomd
|