My goal was to use what I have learned to make a GUI with three buttons to open the corresponding .ahk file. With my code so far it works perfectly until I add the code to close the script when I close the GUI. When I add this code...
GuiClose:
ExitApp
return
to the top, it makes the script close itself as soon as it runs. But I only want that bit of code to run if I press the X button on the GUI. What am I missing here?
All of my code:
#SingleInstance, force
GuiClose:
ExitApp
return
Gui, Add, Button, y0 x0 w32 h32 g1, 1
Gui, Add, Button, y0 x45 w32 h32 g2, 2
Gui, Add, Button, y0 x90 w32 h32 g3, 3
Gui, Show, x800 y50 w150 h100, The Gui
return
1:
run, open "C:\users\Milquetoast\Desktop\learned.ahk"
return
2:
run, open "C:\users\Milquetoast\Desktop\learned2.ahk"
return
3:
run, open "C:\users\Milquetoast\Desktop\learned3.ahk"
return