user3561887
user3561887

Reputation: 13

Sleep not activating

This script allows me to toggle the spam of the 1 key. While it does work, Sleep does not seem to activate. This is copied code. Can anyone explain to me why?

$1::
  KeyWait, 1
  While !GetKeyState("1","P")
   Send 1,
   Sleep 100,
  KeyWait, 1
Return

Upvotes: 1

Views: 102

Answers (1)

vasili111
vasili111

Reputation: 6930

Try this:

$1::
  KeyWait, 1
  While !(GetKeyState("1","P"))
  {
    Send, 1
    Sleep, 100
  }
  KeyWait, 1
Return

Upvotes: 2

Related Questions