0
votes

How do I setup autohotkey so that it repeats the keys on the numpad? Here's the naive version of it:

{
keys = 23456790.-+/*   ; all the keys you want to accelerate 
Loop Parse, keys 
   Hotkey *%A_LoopField%, KEY 
Return 

KEY: 
   StringRight key, A_ThisHotKey, 1 
   t := 0.11            ; initial delay [seconds] 
   Loop { 
      Send {BLIND}{RAW}%key% 
      KeyWait %key%, T%t% 
      If ErrorLevel = 0 
         Break 
      t := t > 0.12 ? t*0.79 : 0.115   ; delay *= 0.80, while delay > 0.02 
   }
return
}

I had hoped that just replacing "2" with "{Numpad2}" (and similarly in the other slots) would do the trick, but it doesn't.

1
You should change your approach. Instead of extracting the number from the string, treat the hotkeys as they are. So don't send 2 instead of Numpad2, but just send Numpad2. I don't think KeyWait is needed. Just have a timer that measures the time passed and send a key if it is time to.2501

1 Answers

1
votes

This seems to work

$Numpad0::
$Numpad1::
$Numpad2::
$Numpad3::
$Numpad4::
$Numpad5::
$Numpad6::
$Numpad7::
$Numpad8::
$Numpad9::
$NumpadDot::
$NumpadSub::
$NumpadMult::
$NumpadDiv::
$NumpadDel::
$7::
$8::
$9::
$0::
StringReplace, ThisKeyLabel, A_Thishotkey, $
While GetKeyState(ThisKeyLabel,"P")
{
    Random, r, 10, 30
    sleep r
    Send % "{" . ThisKeyLabel "}"
}
return