#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
;#include <MsgBoxConstants.au3>
GUICreate("Test Status Management v1.0", 800, 300)
$idListview = GUICtrlCreateListView("", 15, 15, 550, 268)
GUISetState(@SW_SHOW)
$Group4 = GUICtrlCreateGroup("Function Buttons", 585, 20, 120, 215)
$Button3 = GuiCtrlCreateButton("PowerReset UUT", 600, 45, 90, 30)
$Button2 = GuiCtrlCreateButton("BaudRate-9600", 600, 80, 90, 30)
$Button4 = GuiCtrlCreateButton("SOL", 600, 115, 90, 30)
$Button1 = GuiCtrlCreateButton("-----", 600, 246, 90, 30)
_GUICtrlListView_AddColumn($idListview, "Tester", 100)
_GUICtrlListView_AddColumn($idListview, "Test Item", 100)
_GUICtrlListView_AddColumn($idListview, "BMC IP", 100)
_GUICtrlListView_AddColumn($idListview, "Count", 60)
_GUICtrlListView_AddColumn($idListview, "Last Record Time", 150)
_GUICtrlListView_SetItemCount($idListview, 5000)
_add_lv_items()
AdlibRegister('_add_lv_items', 5000); 5秒刷新数据
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Func _add_lv_items()
while 1
Local $path, $aFileList, $aNewList[1][2]
$path = "\\10.32.15.40\temp\mike"
$aFileList = _FileListToArray($path, "*.txt")
If IsArray($aFileList) Then
ReDim $aNewList[UBound($aFileList)][5] ;;;[Col count]
For $i = 0 To UBound($aFileList) - 1 Step 1
$aNewList[$i][0] = $aFileList[$i]
$aNewList[$i][1] = FileReadLine($aFileList[$i], 1)
$aNewList[$i][2] = FileReadLine($aFileList[$i], 2)
$aNewList[$i][3] = FileReadLine($aFileList[$i], 3)
$aNewList[$i][4] = FileReadLine($aFileList[$i], 4)
Next
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($idListview))
_GUICtrlListView_AddArray($idListview, $aNewList)
EndIf
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
; Case $Checkupdate1
; Case $Checkupdate2
; Case $Checkupdate3
; Case $Radio1
; Case $Radio2
; Case $Radio3
Case $Button2
run("Baud9600.exe")
Case $Button3
run("PowerReset.exe")
Case $Button4
run("SOL.exe")
EndSwitch
WEnd
EndFunc