프로그래밍

esc 두번 눌러 창닫기

do121 2023. 2. 15. 20:34

; Set the time window in milliseconds during which the second
; Esc key press must occur for it to be recognized as a double press.
; Increase or decrease this value as necessary.
doublePressTimeout := 300

; This variable keeps track of the time of the last Esc key press.
lastEscPressTime := 0

; This function is called when the Esc key is pressed.
Esc::
    ; Get the current time.
    currentTime := A_TickCount
    
    ; If the time elapsed since the last Esc press is less than the
    ; double press timeout, it's a double press, so close the active window.
    if (currentTime - lastEscPressTime < doublePressTimeout) {
        WinClose, A
    }
    ; Otherwise, it's a single press, so send the Esc key.
    else {
        Send {Esc}
    }
    
    ; Record the current time as the time of the last Esc press.
    lastEscPressTime := currentTime
return

'프로그래밍' 카테고리의 다른 글

sql 명령어 예제  (0) 2024.05.15
[ahk]마우스 휠 가속  (0) 2023.07.03
반복클릭 chatgpt  (0) 2023.04.07
github 사용법 간단  (0) 2022.11.28