Sign in to follow this  
Followers 0
shrapnel2038

Sending keystroke random number of time

5 posts in this topic

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!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks JohnOne.

I feel really stupid right now because I saw the first way in the help file, I just didn't realize what the whole break in quotes did... Yay for late night programming :mellow:

Share this post


Link to post
Share on other sites

Concatenate is your friend and is very helpful in combining variables into commands, strings, and whatnot.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
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
Sign in to follow this  
Followers 0