本帖最后由 afan 于 2009-12-31 19:10 编辑 $str = FileRead('1.txt')
$array = StringRegExp($str, '[\n|\t]([^\n\t]+)', 3)
If @error Then Exit
For $i = 1 To UBound($array) - 3 Step 6
MsgBox(0, 0, _
'Drive:' & $array[$i] & @CRLF & _
'No.:' & $array[$i + 1] & @CRLF & _
'Active:' & $array[$i + 2] & @CRLF & _
'VolumeLabe:' & $array[$i + 3] & @CRLF & _
'Total (Mb):' & $array[$i + 4] & @CRLF & _
'Free (Mb):' & $array[$i + 5])
Next
下面是完整的载入列表例子~#include <GuiListView.au3>
$Form1 = GUICreate("测试", 400, 200)
$ListView1 = GUICtrlCreateListView('Drive|No.|Active|VolumeLabe|Total (Mb)|Free (Mb)', 5, 5, 390, 150)
$BtSx = GUICtrlCreateButton('刷新/载入', 200, 165, 90, 25)
$BtExit = GUICtrlCreateButton('退出', 300, 165, 90, 25)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3, $BtExit
Exit
Case $BtSx
_GUICtrlListView_DeleteAllItems($ListView1)
ld('1.txt')
EndSwitch
WEnd
Func ld($iFile)
Local $array = StringRegExp(FileRead($iFile), '[\n|\t]([^\n\t]+)', 3), $i, $dt
If @error Then Return MsgBox(48, 0, '错误')
For $i = 1 To UBound($array) - 3 Step 6
$dt = $array[$i] & '|' & $array[$i + 1] & '|' & $array[$i + 2] & '|' & $array[$i + 3] & '|' & $array[$i + 4] & '|' & $array[$i + 5]
GUICtrlCreateListViewItem($dt, $ListView1)
Next
EndFunc ;==>ld
|