Skip to content

Instantly share code, notes, and snippets.

@CGBeast
Last active December 20, 2017 10:47
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 CGBeast/538d2ce6bb54acf6eadb63da74b72260 to your computer and use it in GitHub Desktop.
Save CGBeast/538d2ce6bb54acf6eadb63da74b72260 to your computer and use it in GitHub Desktop.
; With the help of this code when I double tap Q within 0.2 seconds (200 miliseconds) the script will send contrl + ald + shift + F12 instead of Q.
#if WinActive("ahk_class Notepad") ;Replace Favorite_Program with the class of your desired program)
$q:: ;Replace Q with the key you want to double tap
t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
;Replace 200 with a lower number if you want a smaller listening window or a higher number for a bigger listening window.
settimer, tappedkey_q, %t%
if (t == "off")
goto double_q
return
tappedkey_q:
Send {q} ;Replace Q with the key you want to double tap
return
double_q:
Send, +{o} ;Replace O with the key you want to double tap. You can add or remove modifiers (alt,shift, etc)
return
;By clicking Scroll lock you will pause the script. Click again to allow the script to work.
Scrolllock::
Suspend,Toggle
Return
#if WinActive("ahk_class 3DSMAX")
$q::
t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
settimer, tappedkey_q, %t%
if (t == "off")
goto double_q
return
tappedkey_q:
Send {q}
return
double_q:
Send, ^!+{F12}
return
$x::
t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
settimer, tappedkey_x, %t%
if (t == "off")
goto double_x
return
tappedkey_x:
Send {x}
return
double_x:
Send, ^!+{x}
return
$y::
t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
settimer, tappedkey_y, %t%
if (t == "off")
goto double_y
return
tappedkey_y:
Send {y}
return
double_y:
Send, ^!+{y}
return
$z::
t := A_PriorHotkey == A_ThisHotkey && A_TimeSincePriorHotkey < 200 ? "off" : -200
settimer, tappedkey_z, %t%
if (t == "off")
goto double_z
return
tappedkey_z:
Send {z}
return
double_z:
Send, ^!+{z}
return
Scrolllock::
Suspend,Toggle
Return
+Scrolllock::
reload
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment