Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:33
Show Gist options
  • Save JoeGlines/926a2829416bf0ef3c562e5e54360d05 to your computer and use it in GitHub Desktop.
Save JoeGlines/926a2829416bf0ef3c562e5e54360d05 to your computer and use it in GitHub Desktop.
;*******************************************************
; 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/ Author: Bon
$Escape:: ; Long press (> 0.5 sec) on Esc closes window
KeyWait, Escape, T0.5 ; Wait up to 0.5 sec for key release (suppress auto-repeat)
If ErrorLevel ; timeout, so long press
PostMessage, 0x112, 0xF060,,, A ; ...use PostMessage to close the active window
Else ; otherwise...
Send {Esc} ; ...just send Escape
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment