方法一#include <File.au3>
$a = 2
$filename = _TempFile(@TempDir, "~test", ".txt", 5)
$file = FileOpenDialog("test", @ScriptDir, "所有文件(*.*)", 7)
Local $temp = ""
If Not @error Then
$file = StringRegExpReplace($file, "\|", @CRLF)
FileWrite($filename, $file)
$fileopen = FileOpen($filename, 0)
If Not @error Then
While 1
If StringInStr(FileReadLine($fileopen, $a), "") Then
$temp &= FileReadLine($fileopen, $a) & @CRLF
Else
If FileReadLine($fileopen, $a) <> "" Then
$temp &= FileReadLine($fileopen, 1) & "" & FileReadLine($fileopen, $a) & @CRLF
EndIf
EndIf
$a += 1
If @error = -1 Then ExitLoop
WEnd
EndIf
MsgBox(0, 0, $temp)
FileClose($fileopen)
FileDelete($filename)
EndIf
方法2 (暂时没想到控制数组的方法)#include <Array.au3>
Local $temp3[20][2]
$file=FileOpenDialog("test",@ScriptDir,"所有文件(*.*)",7)
If Not @error Then
$file=StringRegExpReplace($file,"\|",@CRLF)
$temp1=StringRegExp($file,"(?m)^([^\v\\]+)\v*$",3)
$temp2=StringRegExp($file,".*\\.*",3)
For $i=1 To UBound($temp2)-1
$temp3[$i-1][1]=$temp2[$i]
Next
For $y=0 To UBound($temp1)-1
$temp3[$y][0]=$temp2[0]&""&$temp1[$y]
Next
endif
_ArrayDisplay($temp3)
|