Input data theo hàng ngang từ file ra cột Autohotkey
#SingleInstance Force
#installKeybdHook
#Persistent
AppName=Library
Menu, Tray, Tip, %AppName%
Menu, Tray, Icon, Shell32.dll, 285, 1
TrayTip, %AppName%, Started, 1
SoundBeep, 300, 150
SetWorkingDir %A_ScriptDir%
FileName:="Books.csv" ; define CSV file name
If Not FileExist(FileName) ; Check if file exists, if not create a file with many (identical) entries
FileAppend,
(
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
Darby,Conley,Bucky Katt's Big Book of Fun,978-0-7407-4136-5
), %FileName%
Gui,+AlwaysOnTop ; Keep GUI ontop
Gui, add, listview, w500 h400 gMyListView vmylistview, ISBN|Title|Last Name|First Name
Loop Read, %FileName% ; Read the CSV file
{
StringSplit, item, A_LoopReadLine, `, ; Split the line from the CSV and store in item1...item4. item0 = Nr of fields
LV_Add("",item4,item3,item1,item2) ; Throw the items in the list
}
LV_ModifyCol() ; Auto-Resize the columns
gui, show, AutoSize Center , %FileName%
return
MyListView: ; Run this script on double clicking an item in the list
GuiControlGet, mylistview ; Retrieve the ListBox's current data
currowid := LV_GetNext(0, "F") ; Get the current row number
LV_GetText(Data1, currowid,1) ; Get the data of field 1 for this row and store in Data1
LV_GetText(Data2, currowid,2)
LV_GetText(Data3, currowid,3)
LV_GetText(Data4, currowid,4)
MsgBox, 4096,%FxAppName% Alert, %Data2% %Data1% ; Show alertbox with details of selected item
Return
GuiEscape: ; When you press Escape
GuiClose: ; When you click on the x to close the window
Gui, Cancel ; Close the window
Gui, Destroy ; Delete the window setup
ExitApp ; Close the application (icon disappears)
Đăng nhận xét