Sign in to follow this  
Followers 0
iSeeCream

Random Number Text Input *HELP*

7 posts in this topic

#1 ·  Posted (edited)

Hey, so i am extremely new to autoit and have taken a break for awhile. I am making a simple script in which it enters random numbers and hits search. I have everything ready except for the random number, first i tried repeating the text "send" with different numbers, but then i tried to integrate a random number generator into it.

Send("Random ( 1 , 20 ){ENTER}")

Any help or answers would be appreciated!

SECOND QUESTION:

MouseClick("left", 150, 870, 1)
MouseClick("left", 750, 150, 1)
MouseClick("left", 700, 150, 1)
Send("lol this is cool {ENTER}")
Sleep(5000)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
Send("lol this is cool {ENTER}")
Sleep(5000)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
Send("dah dah dah {ENTER}")
Sleep(5000)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
Send("dahdahhdi {ENTER}")
Sleep(5000)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
Send("hahahahahahhaah {ENTER}")
Sleep(5000)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
MouseClick("left", 700, 150, 1)
Send("Random ( 1 , 20 ){ENTER}")

Thats my code, but how i can i make it stop while its in the middle of working? I have tried almost all stop scripts and the help file but nothing seems to work.

Edited by iSeeCream

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

$vRandom = Random(1, 20)
Send($vRandom)
Send("{ENTER}")

2nd Question:

elaborate on what you mean by stop

Edited by dufran3

Share this post


Link to post
Share on other sites

Hey, so i am extremely new to autoit and have taken a break for awhile. I am making a simple script in which it enters random numbers and hits search. I have everything ready except for the random number, first i tried repeating the text "send" with different numbers, but then i tried to integrate a random number generator into it.

Send("Random ( 1 , 20 ){ENTER}")
Try this:

Send(Random ( 1 , 20 ) & "{ENTER}")

SECOND QUESTION:

Thats my code, but how i can i make it stop while its in the middle of working? I have tried almost all stop scripts and the help file but nothing seems to work.

You can use a hotkey. Take a look to HotKeySet.

Share this post


Link to post
Share on other sites

I mean that i want the cursor to stop moving and the script to stop. And sash, i tried that, but it didn't work.

Share this post


Link to post
Share on other sites

And sash, i tried that, but it didn't work.

What is not working?. Because I tried it before posting and it really works.

Share this post


Link to post
Share on other sites

Can you post what you used? I followed the help EXACTLY but got nothing. And does this have to be at end or start of script?

Share this post


Link to post
Share on other sites

Can you post what you used? I followed the help EXACTLY but got nothing. And does this have to be at end or start of script?

Ok, just an example. Create a new au3 file, open that file into Scite Editor and copy & paste below code. Put your cursor at the end of the script and press F5 to execute the script. In the meantime the script executes (you have 10 seconds) press ESC key and it will stop.

HotKeySet("{ESC}", "Terminate")

;Your code starts here
For $i=1 to 10 Step 1
Send(Random(1,20) & "{ENTER}")
Sleep(1000)
Next
;Your code ends here

Func Terminate()
    Exit 0
EndFunc

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