In the v2 #4 example, MyGui is used as the name. I tried doing the same with the v1 #4 example, but the OK button no longer functions.
Code: Select all
Gui, MyGui:Add, Text,, Pick a file to launch from the list below.`nTo cancel, press ESCAPE or close this window.
Gui, MyGui:Add, ListBox, vMyListBox gMyListBox w640 r10
Gui, MyGui:Add, Button, Default, OK
Loop, C:\Users\fade2gray\CheatEngine\CEC-v2\*.ahk ; Change this folder and wildcard pattern to suit your preferences.
{
GuiControl, MyGui:, MyListBox, %A_LoopFileFullPath%
}
Gui, MyGui:Show
return
MyListBox:
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:
GuiControlGet, MyListBox, ; Retrieve the ListBox's current selection.
MsgBox, 4,, Would you like to launch the file or document below?`n`n%MyListBox%
IfMsgBox, No
return
; Otherwise, try to launch it:
Run, %MyListBox%,, UseErrorLevel
if (ErrorLevel = "ERROR")
MsgBox Could not launch the specified file. Perhaps it is not associated with anything.
return
GuiClose:
GuiEscape:
ExitApp