Code: Select all
#Persistent
#SingleInstance Force
Menu, MyMenu, Add, Label1
Menu, MyMenu, Add, Label2
Menu, MyMenu, Show
if (A_Args.1 = "Label1") {
Gosub, Label1
ExitApp
} else {
Loop, % A_Args.Count()
if IsLabel(A_Args[A_Index])
Gosub, % A_Args[A_Index]
}
return
Label1:
SetTimer, Timer, 500
return
Timer:
DriveGet, status, Status, Z:\
if (status = "Invalid")
return
SetTimer, Timer, Off
return
Label2:
Gosub, Label1
Run app.exe
ExitApp
When I select Label1 from the menu, how can I exit the app as happens when I pass it as a parameter?
How can I exit the app if I click away from the menu?