谢谢!最终成品如下:$array=StringSplit(@ScriptName, '.')
FileDelete($array[1] & '.html')
$search = FileFindFirstFile("*.txt")
If $search = -1 Then
MsgBox(64, "错误", "当前目录没有可用的.txt文件", 5)
Exit
EndIf
FileWrite($array[1] & '.html', '<body> <BR>')
While 1
$Nfile = FileFindNextFile($search)
If @error Then ExitLoop
$file = FileOpen($Nfile, 0)
If $file = -1 Then
MsgBox(0, "错误", "不能打开文件.")
Exit
EndIf
Local $Str
While 1
$line = FileReadLine($file)
If @error = -1 Then ExitLoop
$Str &= $line
WEnd
FileClose($file)
Local $sR = StringRegExp($Str, '\d{6}(?=\.shtml)', 3)
If @error Then Exit MsgBox(0, 0, @error)
Local $txt, $i
For $i = 0 To UBound($sR) - 1
$txt = '<a' & ' href="http://www.ks5u.com/downsch.asp?id=' & $sR[$i] & '"' & ' /a>' & '链接' & $sR[$i] & '<BR>'
FileWrite($array[1] & '.html', $txt)
Next
WEnd
FileWrite($array[1] & '.html', '</body>')
ShellExecute($array[1] & '.html')
|