2016-12-26 60 views
0

所以我制作了一个AFK挡板,但是我需要它只能在一个程序中运行,所以我使用#If WinActive但无济于事。AutoHotKey:#IffWinActive not working

#If WinActive("ahk_class WINDOWSCLIENT") 
while(1 = 1) { 
    Send, {W down} 
    sleep 240 
    Send, {W up} 
    sleep 240 
    Send, {A down} 
    sleep 240 
    Send, {A up} 
    sleep 240 
    Send, {S down} 
    sleep 240 
    Send, {S up} 
    sleep 240 
    Send, {D down} 
    sleep 240 
    Send, {D up} 
} 

回答

0

#IfWin directives仅用于创建上下文相关的热键和热字串。 尝试使用循环或SetTimer的与IfWinActive

Loop 
{ 
    If WinActive("ahk_class WINDOWSCLIENT") 
    { 
     while(1 = 1) 
     { 
      ; do something 
     } 
    } 
} 
+0

干杯我的朋友。 – Ninsto