Jump to content

holding key down not working in loop


Recommended Posts

im trying to make randomly hold 3 keys but its doesnt work any suggestions?

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------


; Script Start - Add your code below here


Global $Paused, $counter = 0
HotKeySet ("{HOME}", "Start")
HotKeySet ("{END}", "_Exit")





While 1
Sleep(200)
WEnd

Func Start()
While 1
    call ("ClickRandomly")
    sleep (500)
WEnd
EndFunc


Func ClickRandomly()
    Local $RandomNumber = Random(1,3,1)
    If $RandomNumber == 1 Then

send ("{a down}")
sleep (2000)
send ("{A UP}")
sleep (5000)
    EndIF

  If $RandomNumber == 2 Then

send ("{d down}")
sleep (2000)
send ("{d UP}")
sleep (5000)
EndIF
       If $RandomNumber == 3 Then
send ("{w down}")
sleep (2000)
send ("{w UP}")
sleep (5000)
    EndIF

EndFunc


Func _Exit()
Exit
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...