FrozenScriptz Posted June 8, 2010 Share Posted June 8, 2010 Hello so ive been wondering how do I make my script run multiple times? like a mouse will click on a pixel that the pixel search has found and I want my script to do it again. Example Code: $var1 = PixelSearch ( 0,0, 1279, 1023, 0xFF0000 ) If Not @error Then MouseClick("Left", $var[0], $var[1], 1) EndIf I know I need to use Do or While Loop but I don't know how to use them well. Link to comment Share on other sites More sharing options...
jaenster Posted June 8, 2010 Share Posted June 8, 2010 I guess you are learning autoit. Well it is kinda simpel, look at the helpfile or autoit3\Examples\Helpfile\For.au3 -jaenster Link to comment Share on other sites More sharing options...
Shiro Posted June 8, 2010 Share Posted June 8, 2010 Some kind of loop like For...Next While...WEnd Link to comment Share on other sites More sharing options...
DarkHo Posted June 8, 2010 Share Posted June 8, 2010 (edited) Like Shiro For... Next While...WEnd Or While 1 CODE HERE WEnd Edited June 8, 2010 by DarkHo Link to comment Share on other sites More sharing options...
FrozenScriptz Posted June 9, 2010 Author Share Posted June 9, 2010 Okay I'll try those Link to comment Share on other sites More sharing options...
FrozenScriptz Posted June 14, 2010 Author Share Posted June 14, 2010 Thanks guys I tried to code on myself by using while but didn't try do yet, but while is cool and its too fast Link to comment Share on other sites More sharing options...
JohnOne Posted June 14, 2010 Share Posted June 14, 2010 add a sleep() if its to fast. 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 More sharing options...
FrozenScriptz Posted June 15, 2010 Author Share Posted June 15, 2010 So its gonna be like this? $t = 0 while $t < 10 msgbox(0,"","Hi") $t = $t + 1 wend sleep(1000) Please reply quick Link to comment Share on other sites More sharing options...
sahsanu Posted June 15, 2010 Share Posted June 15, 2010 (edited) You should put the Sleep inside the While loop. $t = 0 while $t < 10 msgbox(0,"","Hi") $t = $t + 1 sleep(1000) wend Edit: I didn't see your "Please reply quick" and I agree Tvern, that isn't the right way to ask for help. Edited June 15, 2010 by sahsanu Link to comment Share on other sites More sharing options...
Tvern Posted June 15, 2010 Share Posted June 15, 2010 Your sleep will only be executed when the loop is finished. You'd want your code to look liek this. Local $t = 0 While $t < 10 MsgBox(0,"","Hi") Sleep(1000) ;put the sleep inside the loop $t += 1 ;this is another way to increate $t by 1 Wend A For...To...Next loop would be better for this code: For $t = 0 To 9 ;this declares $t and automatically increments it by 1, untill $t is 9 at which point the loop will run one last time before it exits. MsgBox(0,"","Hi") Sleep(1000) Next Please reply quick That almost stopped me from replying. I doubt anyone will feel more inclined to help you if you tell em to be quick about it. 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