2017-04-15 382 views
0

好的,快速的問題。我有一個腳本,在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,第一個腳本也執行..

回答

0

三重組合難以使用。最好我能想出是:

方法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 
1

本標準語法

#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 

這個問題存在多次已。