Autohotkey - 3个按键?
问题描述:
好的,快速的问题。我有一个脚本,在right mouse is pressed + left ctrl is pressed
时运行。Autohotkey - 3个按键?
如何扩展此脚本,以便在按下left ctrl + w + right mouse
时,将执行一个不同的脚本,但不会执行第一个脚本。
所以,如果我按LCtrl + w + RButton
,一件事情执行,如果我按LCtrl + RButton
,另一件事情执行?
我希望这不是太混乱..
什么,我试图实例...
~LCtrl & ~RButton:: ; do something
#if GetKeyState("RButton","LCtrl") && GetKeyState("RButton","LCtrl")
~w::
; do something
return
#if
的问题是,当我尝试做左侧ctrl +右键+ W,第一个脚本也执行..
答
三重组合难以使用。最好我能想出是:
方法1:
~LCtrl & ~RButton up::
Input, key, L1 T0.5
if (key == "w")
MsgBox % "You pressed LCtrl & Rbutton & W"
else
MsgBox % "You just pressed LCtrl & RButton"
return
方法2:
~LCtrl & ~RButton::
While (A_TimeSinceThisHotkey < 500) {
If (GetKeyState("w", "P")) {
MsgBox % "You pressed LCtrl & RButton & W"
return
}
}
MsgBox % "You Pressed LCtrl & RButton"
return
答
本标准语法
#if getkeystate("w", "P") ; # this "#if" is only for hotkey definitions conditions, not to be confused with "if"
LCtrl & RButton::
; do this
return
#if ; end of hotkey conditions
LCtrl & RButton:: ; w is not pressed
; do that
return
这个问题存在多次已。