Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active July 27, 2022 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeGlines/2c47f5f2ab8fb66def11e3771ec9996f to your computer and use it in GitHub Desktop.
Save JoeGlines/2c47f5f2ab8fb66def11e3771ec9996f to your computer and use it in GitHub Desktop.
use the escape key to close the active program
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
;~ http://www.autohotkey.com/board/topic/80697-long-keypress-hotkeys-wo-modifiers/
~$Esc:: ; Long press (> 0.5 sec) on Esc closes window
KeyWait, Escape, T0.5 ; Wait no more than 0.5 sec for key release (also suppress auto-repeat)
If ErrorLevel ; timeout, so long press
PostMessage, 0x112, 0xF060,,, A ;Use PostMessage to close window
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment