AHK (AutoHotkey) â
Wait for a window to appear, then bind hotkey to it (context sensitive) â
@see https://www.autohotkey.com/docs/v2/lib/_HotIf.htm
if WinWait("ahk_exe DOSBox.exe") {
#HotIf WinExist("ahk_exe DOSBox.exe")
Esc:: {
If (A_PriorHotkey = "Esc" and A_TimeSincePriorHotkey < 500) {
ProcessClose "dosbox.exe"
Run "taskkill /im dosbox.exe /F",, "Hide"
}
}
}