#include <array.au3>
#include <Excel.au3>
$xlsfile = @ScriptDir & "\abc.xls"
$oExcel1 = _ExcelBookOpen($xlsfile, 1)
For $i = 2 To 4
$read_link = _ExcelReadCell($oExcel1, $i, 1)
$bool = False
Do
If FileExists(@TempDir & "\tmp.html") Then FileDelete(@TempDir & "\tmp.html")
$hDownload = InetGet($read_link, @TempDir & "\tmp.html", 1, 1)
Do
Sleep(1000)
$a = InetGetInfo($hDownload, -1)
If $a[4] Then ExitLoop
Until $a[2]
InetClose($hDownload)
If Not $a[4] Then $bool = True
Until $bool
$fp = FileOpen( @TempDir & "\tmp.html")
$read_buf = FileRead($fp)
FileClose($fp)
$array_1 = StringRegExp($read_buf, "<(?i)li>(.*?)</(?i)li>", 3)
For $j = 0 To UBound($array_1)-1
$array_2 = StringRegExp($array_1[$j], "<(?i)span>(.*?)</(?i)span>", 3)
_ExcelWriteCell($oExcel1, $array_2[1], $i, $j+2)
Next
Next
MsgBox(0,"","3秒后自动关闭",3)
_ExcelBookClose($oExcel1, 1)
看着方便点。 |