Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:29
Show Gist options
  • Save JoeGlines/2b69e60ec93f3205872c569a3346e1d2 to your computer and use it in GitHub Desktop.
Save JoeGlines/2b69e60ec93f3205872c569a3346e1d2 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
;*******************************************************
shift := []
Loop 10 {
shift.Push(A_Index - 1)
}
Loop % Asc("z") - Asc("a") + 1 {
shift.Push(Chr(Asc("a") + A_Index - 1))
}
for i, key in shift {
fun := Func("KeyPressed").Bind(key, 300)
Hotkey, % "$" key, % fun
}
KeyPressed(key, duration) {
time := A_TickCount
While(GetKeyState(key, "P")) {
if(A_TickCount - time > duration) {
Break
}
Sleep, 25
}
Send, % A_TickCount - time > duration ? "+" key : key
KeyWait, % key
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment