Code: Select all
Right::
ToggleScripts()
return
ToggleScripts() {
static toggle := false
toggle := !toggle
if (toggle) {
; Terminate (L) Scripts
Run, % A_ComSpec " /c taskkill /F /IM ""Strike (L).ahk"" /T",, Hide
Run, % A_ComSpec " /c taskkill /F /IM ""Supers (L).ahk"" /T",, Hide
; Run (R) Scripts
Run, "Strike (R).ahk", , Min
Run, "Supers (R).ahk", , Min
} else {
; Terminate (R) Scripts
Run, % A_ComSpec " /c taskkill /F /IM ""Strike (R).ahk"" /T",, Hide
Run, % A_ComSpec " /c taskkill /F /IM ""Supers (R).ahk"" /T",, Hide
; Run (L) Scripts
Run, "Strike (L).ahk", , Min
Run, "Supers (L).ahk", , Min
}
}
The above script doesn't work. I'm trying to launch two scripts, while terminating two other scripts, and vice versa, using Right as my toggle hotkey. Launching the scripts works, but terminating the scripts doesn't. I have tried other options like "Process, Close" but it doesn't let me terminate either. What could be the issue?