[已解決]請問如何讀取到share folder裡面txt的資料?
本帖最后由 ipmitool 于 2016-5-19 20:46 编辑請問如何讀取到share folder裡面txt的資料?
share folder為 \\10.32.15.40\temp\mike\
1.txt
sdfasdfsadfasdadfasdfasdfasdfs!ER#$@sdfasdfsadfasdadfasdfasdfas
2.txt
sdfasdfsad@fasdadfasdfasdfasdfs!ER#$@sdfasdfsadfasdadfasdfasdfas
sdfasdfsadfasdadfasdfasdfasdfs!ER#$@sdfasdfsadfasdadfasdfasdfas
3.txt
sdfsdfsf@w32
dsfgsg@dvsfgds
advsfgfhnjt5
Sdsdfgdgdgh
dsfw43@wrgt35y45@jmryjr
4.txt
advfssfdfbg5324353@wr535t3y
ergergy43@243453
@Vadgwrgwg
VDsaf@gryjhr#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
$path = "\\10.32.15.40\temp\mike\"
$aFileList = _FileListToArray($path, "*.txt")
If IsArray($aFileList) Then
ReDim $aNewList ;;;
For $i = 0 To UBound($aFileList) - 1 Step 1
$aNewList[$i] = $aFileList[$i]
$aNewList[$i] = FileReadLine($aFileList[$i], 1)
$aNewList[$i] = FileReadLine($aFileList[$i], 2)
$aNewList[$i] = FileReadLine($aFileList[$i], 3)
$aNewList[$i] = 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
$o_File = FileOpen("\\10.32.15.40\temp\mike\1.txt")
$t_File = FileRead($o_File)
FileClose($o_File)
MsgBox(0,0,$t_File)
不過我要去讀folder下所有的txt的內容耶...
$path = "\\10.32.15.40\temp\mike\"
$aFileList = _FileListToArray($path, "*.txt") 我搞定了, 加下面這一行就搞定了~
FileChangeDir("\\10.32.15.40\temp\Mike") 請問如何偵測每行資料, 10分鐘沒更新狀態, 就回報msg error呢? 謝謝各位大大
页:
[1]