Ghi dữ liệu từ file txt ra listview
Gui Add, ListView, x5 y4 w298 h173 AltSubmit Checked , |Pid|Trạng thái|Cá bắt được|Đứt dây
Gui Show, w308 h381, Window
return
f1::
WinGet, Window, List, ahk_class Qt5QWindowIcon
Loop %Window%
{
Id:=Window%A_Index%
WinGetTitle, TVar , % "ahk_id " Id
Window%A_Index%:=TVar ;use this if you want an array
tList.=TVar "`n" ;use this if you just want the list
}
FileDelete, D:\AHK\AutoHotKey\AutoCauCa\data.txt
FileAppend, %tList%, D:\AHK\AutoHotKey\AutoCauCa\data.txt
Loop Read, D:\AHK\AutoHotKey\AutoCauCa\data.txt ; Read the CSV file
{
StringSplit, item, A_LoopReadLine, `n ; Split the line from the CSV and store in item1...item4. item0 = Nr of fields
;LV_Add("",,,item1) ; Throw the items in the list
;LV_Add("",,,item2)
Loop, %item0%
{
this_array := item%A_Index%
;MsgBox, Pid %A_Index% is %this_array%.
;LV_ModifyCol() ; Auto-Resize the columns
LV_Add("",,this_array)
}
}
return
GuiEscape:
GuiClose:
ExitApp
Đăng nhận xét