2 ) оба варианта работают, спасибо большое.
3) Позаимствовал еще такой код классный, по escape длительному нажатию и отпусканию ,закрывает окно(Alt+F4 эквивалент)
Прекрасно работает . Однако вместе со вторым кодом, не работает в одном ahk . Как их совместить ?
;20) удерживая ескейп закрыть окно
$Escape:: ; Long press (> 0.5 sec) on Esc closes window - but if you change your mind you can keep it pressed for 3 more seconds
KeyWait, Escape, T0.5 ; Wait no more than 0.5 sec for key release (also suppress auto-repeat)
If ErrorLevel ; timeout, so key is still down...
{
SoundPlay *64 ; Play an asterisk (Doesn't work for me though!)
WinGet, X, ProcessName, A
SplashTextOn,,150,,`nRelease button to close %x%`n`nKeep pressing it to NOT close window...
KeyWait, Escape, T3 ; Wait no more than 3 more sec for key to be released
SplashTextOff
If !ErrorLevel ; No timeout, so key was released
{
PostMessage, 0x112, 0xF060,,, A ; ...so close window
Return
}
; Otherwise,
SoundPlay *64
KeyWait, Escape ; Wait for button to be released
; Then do nothing...
Return
}
Send {Esc}
Return