InDir = %A_MyDocuments%\bin InputMsg = "Enter word or for list:" StringSplit MyNameTmp, A_ScriptName, `. MyName = %MyNameTmp1% infile = %InDir%\%MyName%.txt InputBox, OutputVar, %MyName%, %InputMsg% If ErrorLevel ExitApp Else { If OutputVar = { ; Create the ListView with two columns, Name and Size: Gui, Add, ListView, r20 w700 gMyListView, Name|Run Gui, Add, Button, Default, OK ; Gather a list of file names from a folder and put them into the ListView: ;Loop, %A_MyDocuments%\*.* ; LV_Add("", A_LoopFileName, A_LoopFileSizeKB) Loop, read, %infile% { StringSplit, ItemArray, A_LoopReadLine,`,,%A_Space%%A_Tab% LV_Add("", ItemArray1, ItemArray2) } LV_ModifyCol() ; Auto-size each column to fit its contents. ; Display the window and return. The script will be notified whenever the user double clicks a row. Gui, Show return } Loop, read, %infile% { StringSplit, ItemArray, A_LoopReadLine,`,,%A_Space%%A_Tab% If ItemArray1 = %OutputVar% { Run, %ItemArray2%,, UseErrorLevel If ErrorLevel = ERROR MsgBox Could not launch %ItemArray2% ExitApp } } MsgBox "%OutputVar%" not found ExitApp } MyListView: if A_GuiEvent <> DoubleClick return ; Otherwise, the user double-clicked a list item, so treat that the same as pressing OK. ; So fall through to the next label. ButtonOK: RowNum := LV_GetNext() ;MsgBox %RowNum% LV_GetText(RowText, RowNum, 2) ; Get the text from the row's second field. ;MsgBox %RowText% Run, %RowText%,, UseErrorLevel if ErrorLevel = ERROR MsgBox Could not launch the specified file. Perhaps it is not associated with anything. ExitApp return Esc::ExitApp GuiClose: ; Indicate that the script should exit automatically when the window is closed. ExitApp