Elliot's answer pointed me in the right direction (I am completely unfamiliar with the AutoHotKey syntax). His approach uses a window title that works well for programs that don't come down to a system drive. But if you have such a program, it is better to close it based on the process identifier:
^!x::StartClose("XMouseButtonControl.exe") StartClose(exe) { Process, Exist, %exe% ; check to see if program is running If (ErrorLevel = 0) ; If program is not running -> Run { Run, %exe% } Else ; If program is running, ErrorLevel = process id for the target program -> Close { Process, Close, %ErrorLevel% } }
JΓΆrg source share