Bizzet Posted January 20, 2012 Share Posted January 20, 2012 (edited) While 1 Sleep(1000) PixelSearch ($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF) ;If it does find the the white pixel, then the loop will continue. If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then Send("{ENTER}") Sleep(1111) MouseClick("left", 666, 58, 1) Sleep(1111) MouseClick("left", 652, 90, 1) Sleep(500) MouseClick("left", 247, 269, 1) Sleep(500) Send("{TAB}") Send("11111111111") Sleep(100) Send("{ENTER}") Sleep(110) MouseClick("left", 330, 151, 2) ExitLoop EndIf WEnd I'm sure the code above matters in no way but I thought you MAY need to see what I am looping. My question is, How would I pause this loop every so often to play another loop until it finishes, then continue pixelsearching with the above loop? Edited January 20, 2012 by Bizzet Link to comment Share on other sites More sharing options...
jaberwacky Posted January 20, 2012 Share Posted January 20, 2012 This?expandcollapse popupWhile 1 PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF) meaningful_function_name() ;If it does find the the white pixel, then the loop will continue. If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then Send("{ENTER}") Sleep(1111) MouseClick("left", 666, 58, 1) Sleep(1111) MouseClick("left", 652, 90, 1) Sleep(500) MouseClick("left", 247, 269, 1) Sleep(500) Send("{TAB}") Send("11111111111") Sleep(100) Send("{ENTER}") Sleep(110) MouseClick("left", 330, 151, 2) ExitLoop EndIf WEnd Func meaningful_function_name() While True ; useful statement ; useful statement ; useful statement ; useful statement WEnd EndFunc Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 I think the while loop is flawed If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then That means that if the pixel is found, the loop will begin again without carrying out the mouseclick operations you need to reverse your logic. 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...
Bizzet Posted January 20, 2012 Author Share Posted January 20, 2012 This?expandcollapse popupWhile 1 PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF) meaningful_function_name() ;If it does find the the white pixel, then the loop will continue. If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then Send("{ENTER}") Sleep(1111) MouseClick("left", 666, 58, 1) Sleep(1111) MouseClick("left", 652, 90, 1) Sleep(500) MouseClick("left", 247, 269, 1) Sleep(500) Send("{TAB}") Send("11111111111") Sleep(100) Send("{ENTER}") Sleep(110) MouseClick("left", 330, 151, 2) ExitLoop EndIf WEnd Func meaningful_function_name() While True ; useful statement ; useful statement ; useful statement ; useful statement WEnd EndFunc The two functions can not be played at the same time. Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped. When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue. Link to comment Share on other sites More sharing options...
Bizzet Posted January 20, 2012 Author Share Posted January 20, 2012 I think the while loop is flawed If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then That means that if the pixel is found, the loop will begin again without carrying out the mouseclick operations you need to reverse your logic. No, it is right. I want the mouseclicks to play when the white pixel disappears. Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 I stand corrected. 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...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 The two functions can not be played at the same time.Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped.When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue.LaCastiglione code does just that, when the func returns, your main loop will continue. 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...
jaberwacky Posted January 20, 2012 Share Posted January 20, 2012 (edited) WHen it gets to meaningful_function_name then loop1 does stop while loop2 is playing then it returns control back to loop1 Edit: yeah, what he ^^^ said... Edited January 20, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 20, 2012 Share Posted January 20, 2012 The two functions can not be played at the same time.Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped.When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue.Well since you can't have two loops at once... .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Bizzet Posted January 20, 2012 Author Share Posted January 20, 2012 (edited) My current code is expandcollapse popupWhile 1 Sleep(1000) PixelSearch ($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF) Restart() ;If it does find the the white pixel, then the loop will continue. If Not @error Then ContinueLoop ;If PixelSearch does not find the white pixel it will execute the following. ElseIf @error Then Send("{ENTER}") Sleep(1111) MouseClick("left", 666, 58, 1) Sleep(1111) MouseClick("left", 652, 90, 1) Sleep(500) MouseClick("left", 247, 269, 1) Sleep(500) Send("{TAB}") Send("11111111111") Sleep(100) Send("{ENTER}") Sleep(110) MouseClick("left", 330, 151, 2) ExitLoop EndIf WEnd Func Restart() While True Sleep(5000) While 1 Send("{ENTER}") Sleep(1000) Send("{ENTER}") Sleep(222) Send("{ALT}") Sleep(750) MouseClick("left", 655, 88, 2) Sleep(111) MouseClick("left", 779, 57, 2) Sleep(500) Send("Bizzer") Sleep(100) MouseClickDrag ("left", 396, 251, 674, 471) WEnd EndFunc I get an error of "While has no matching Wend statement" It says the error is on the line of the last "EndFunc" I'm sort of lost on what to do because I thought I added "WEnd" ? Edited January 20, 2012 by Bizzet Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 You have 2 While and 1 WEnd Bizzet 1 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...
Bizzet Posted January 20, 2012 Author Share Posted January 20, 2012 okay everything is working great except 1 problem. I do not need to play Loop 2 every time it pixelsearches. I would like it play only every 30 minutes. Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2012 Share Posted January 20, 2012 Then remove it from the main loop and consider the Native function AdlibRegister() 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...
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