How do I change a toggle hotkey to a held hotkey.
How do I change a toggle hotkey to a held hotkey.
In a game I am playing, each time you press x it switches perspective. Is there any way to make it so when I hold down on x it presses it once (so switches perspective), then when I let go it presses it again (switches back to original perspective).
Re: How do I change a toggle hotkey to a held hotkey.
Code: Select all
$x::
Send x
KeyWait, x
Send x
Return
Re: How do I change a toggle hotkey to a held hotkey.
Hallo,
try:
Press the X key down, type S, release X. You will see as long as the S-thread sleeps the X-thread is blocked!
A waiting KeyWait prevents its thread from being terminated. Since in Autohotkey only one thread is active at a time, this can lead to a blockade.
Now try:
or ternarys instead of arrays:
You can alternatively use this Up-Hotkey with "Extended parameters" in both scripts:
https://www.autohotkey.com/boards/viewtopic.php?f=74&t=82267
try:
Code: Select all
$x::
Send x
KeyWait, x
Send x
Return
s::Sleep, 5000
A waiting KeyWait prevents its thread from being terminated. Since in Autohotkey only one thread is active at a time, this can lead to a blockade.
Now try:
Code: Select all
$x::Send,% ["x"][Tx:=1+0 Tx]
$x Up::Send,% ["x"][!Tx:=""]
s::Sleep, 5000
Code: Select all
$x::Send,% (1=Tx:=1+0 Tx)?"x":
$x Up::Send,% (""=Tx:="")?"x":
s::Sleep, 5000
Code: Select all
$x Up::Send,% ("x", Tx:="")
Who is online
Users browsing this forum: No registered users and 107 guests