Jump to content

Recommended Posts

Posted

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!

Posted

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.

Posted

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:

Posted

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

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
  • Recently Browsing   0 members

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