在autohotkey中使用热键切换键 [英] Toggle a key with hotkey in autohotkey
本文介绍了在autohotkey中使用热键切换键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因此,我试图自动运行在地图很大的游戏中,并且我必须跑很多英里.我想打开热键( Ctrl + Shift + A 或其他功能)按下运行键(在游戏中,我可以使用 w ). 我尝试过代码,例如:
So I tried to automate running in a game, where the map is huge, and I have to run miles. I wanted to toggle on the hotkey (Ctrl+Shift+A or something else) press the running (in the game, I can run with w). I tried code, like:
Pause On
Loop
Send w
+^a::Pause
(它可以按w,但不能释放),像这样:
(it can press the w, but it can't release) and like this:
+^a::
toggle := !toggle
while toggle
Send {w down}
(相同的问题). 只是我的问题,还是这些代码是错误的?
(same problem). It's just my problem, or these codes are wrong?
推荐答案
这是我的股票函数.我通常将其映射到^ W或Q.按w或s将取消它.轻松自在.
This is my stock function. I usualy map it to ^W or Q. Pressing w or s will cancel it. Easy peasy.
HoldW(){
SendInput {w up}{w down}
Loop
{
Sleep 100
GetKeyState state, w
if state = u
return
If GetKeyState("s")
{
SendInput {w up}
return
}
}
}
这篇关于在autohotkey中使用热键切换键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文