iSeeCream Posted March 29, 2011 Share Posted March 29, 2011 (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 March 29, 2011 by iSeeCream Link to comment Share on other sites More sharing options...
dufran3 Posted March 29, 2011 Share Posted March 29, 2011 (edited) Try this: $vRandom = Random(1, 20) Send($vRandom) Send("{ENTER}") 2nd Question: elaborate on what you mean by stop Edited March 29, 2011 by dufran3 Link to comment Share on other sites More sharing options...
sahsanu Posted March 29, 2011 Share Posted March 29, 2011 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. Link to comment Share on other sites More sharing options...
iSeeCream Posted March 29, 2011 Author Share Posted March 29, 2011 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. Link to comment Share on other sites More sharing options...
sahsanu Posted March 29, 2011 Share Posted March 29, 2011 And sash, i tried that, but it didn't work.What is not working?. Because I tried it before posting and it really works. Link to comment Share on other sites More sharing options...
iSeeCream Posted March 30, 2011 Author Share Posted March 30, 2011 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? Link to comment Share on other sites More sharing options...
sahsanu Posted March 30, 2011 Share Posted March 30, 2011 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now