full_command_line := DllCall("GetCommandLine", "str")
if (!(A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")))
{
try
{
if (A_IsCompiled)
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
Gui, Add, Button, x10 w80, OK ;
Gui, Add, Button, xp+380 yp w80, Cancel ;
Insert::
Gui, Show,, %varTitle% ;
Pause, On ; Pause the Script Here and Wait for User Input
ButtonOK:
Run notepad
Pause, Off
;GuiEscape: ; Note: single colon here, not double
Gui, Cancel
Pause, Off
return
Pause, Off
return
F12::
send {F12}
sleep, 3000
Process, Close, notepad
Pause, Off
return
Pause, Off
ButtonCancel:
Gui, Cancel
return
Pause, Off
return
When using Cancel Button AutoHotkey (AHK) still launches the application. How to resolve this? Although the OK button functions properly but cancel button still launches the application