2013-04-08 115 views
2

我正在使用AutoHotKey,我想實現某些特定的功能。AutoHotKey KeyWait語句

我有一個熱鍵,應該執行某個動作,在這個熱鍵裏面,我想編碼一些東西來檢測我是否只按下「C」鍵,或者如果我按下「C」然後是「L」鍵。

如果只有按下「C」鍵,那麼它應該執行一個動作,否則,如果「C」然後「L」鍵被按下,它應該做另一個動作。

但我不能這樣做,因爲我真的不明白KeyWait,我的意思是我該怎麼做這樣的事情:

if(KeyWait, C){ 
    firstAction 
else { 
if(KeyWait, C){ 
    if(KeyWait, L){ 
    anotherAction 
} 
} 

回答

2

解決使用input功能。

; Get one character and store it in the Character variable 
Input, Character, L1 
If Character = C 
{ 
    ; Give up to half of one second to type L 
    Input, Character, L1 T0.5 
    If Character = L 
     MsgBox % "We have C and L" 
    else 
     MsgBox % "Just C here, give an L next time" 
} 
+0

謝謝@FakeRainBrigand – Ydhem 2013-04-10 00:19:23