2011-01-22 113 views
0

我已经写在AutoHotkey的下面,以打击针对特定游戏端口非常累人的“冲刺”行动,PC:重复按键每一秒

#SingleInstance,Force 
#NoEnv 
CoordMode,Mouse,Screen 
DetectHiddenWindows,On 
StringTrimRight,applicationname,A_ScriptName,4 
OnExit,EXIT 
Gosub,TRAYMENU 

; Set the first run to turn on the loops 
breakera = 0 
loopa = 1 
breakerw = 0 
loopw = 1 

Shift & LAlt:: 
IfWinExist,Bully 
    { 
     If loopa = 0 
      { 
       loopa := !loopa 
       breakera := !breakera 
      } 
      else 
      { 
       loopa := !loopa 
       breakera := !breakera 
       Loop 
        { 
         Send {LAlt} 
         Sleep, 1000 
         if breakera = 1 
          { 
           break 
          } 
        } 
      } 
    } 
    else 
     { 
      Gosub,BULLYERROR 
     } 
Return 

Shift & W:: 
IfWinExist,Bully 
    { 
     If loopw = 0 
      { 
       loopw := !loopw 
       breakerw := !breakerw 
      } 
      else 
      { 
       loopw := !loopw 
       breakerw := !breakerw 
       Loop 
        { 
         Send {w} 
         Sleep, 1000 
         if breakerw = 1 
          { 
           break 
          } 
        } 
      } 
    } 
    else 
     { 
      Gosub,BULLYERROR 
     } 
Return 

BULLYERROR: 
Gui,97:Destroy 
Gui,97:Margin,20,20 
Gui,97:Font 
Gui,97:Add,Text,y+10 yp+10,Bully is not running! 
Gui,97:Show,,Error 
Return 

我知道这个代码是不完全有效的,但它仍然看起来应该工作,但是,它不(不要担心失踪的子,只是一个片段)。

我的目的是让这个当你按下Shift + Key直至再次按下Shift + Key它重复Key每一秒。

任何想法?谢谢!

回答

0

使用类似这样的东西。

Shift & LAlt:: 
    If AltRepeating = true 
    { 
    SetTimer, RepeatAlt, Off 
    AltRepeating = false 
    } 
    Else 
    { 
    Send, {lAlt} 
    SetTimer, RepeatAlt, 1000 
    AltRepeating = true 
    } 


RepeatAlt: 
    Send, {LAlt} 
Return