Jump to content

Sending keystroke random number of time


Recommended Posts

Hey, everyone. I have been trying to find an answer to this question for a while now and decided to make an account. Sorry if this is an easy one, I'm new to programming in general.

The script I am writing involves pressing the down arrow a random number of times. I have tried a few different ways I could think of, but none of them have worked.

Right now I have:

$var3=Random(1,12,1)

Send("{DOWN}")

I have tried fitting $var3 somewhere in the send command, but it hasn't seemed to work for me.

Thanks in advance for the help!

Link to comment
Share on other sites

There are at least a couple of ways to do it.

The first in these examples can be seen in the helpfile under the Send() function, so I suggest you pay a little more attention to that wonderful resource for future problems.

$var = Random(1,12,1)
Send("{DOWN " & $var & "}"); use the variable in the function call
Sleep(2000)
For $i = 1 To $var ; use it in a loop
Send("{DOWN}")
Next

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...