homemade Posted January 5, 2010 Share Posted January 5, 2010 I have a While loop that does some stuff and I want to add in an If condition to short circuit the loop if certain conditions are met. Problem is, when I use Exitloop it completely stops the script. How do I make it so that when the If condition is true then the script clicks the next button(bolded below), breaks the loop, then restarts it again from the next iteration. expandcollapse popupWhile $j > 0 WinActivate("Home Page - Mozilla Firefox") $hWnd = WinGetHandle("Home Page - Mozilla Firefox") _ClipBoard_SetData ("0") Send("{END}") Sleep(100) MouseClick("right", 554, 606, 1, 0) Send("E") Sleep(10) Send("{ENTER}") Sleep(10) Send("{ESC}") $sMail = ClipGet() _ClipBoard_SetData ("0") MouseClick("right", 554, 730, 1, 0) Send("E") Sleep(10) Send("{ENTER}") Sleep(10) Send("{ESC}") $sMail2 = ClipGet() If $sMail AND $sMail = 0 Then ExitLoop MouseClick("left", 551, 584, 3, 0) Send("^c") $nametrim = ClipGet() $oExcel = _ExcelBookAttach("Book1.xls", "FileName") _ExcelWriteCell($oExcel, $nametrim, $i, 1) _ExcelWriteCell($oExcel, $sMail, $i, 2) WinActivate("Home Page - Mozilla Firefox") [b]MouseClick("left", 779, 931, 1, 0)[/b] Sleep(1900) $i = $i + 1 $j = $j - 1 WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 5, 2010 Share Posted January 5, 2010 ContinueLoop vice ExitLoop. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
homemade Posted January 5, 2010 Author Share Posted January 5, 2010 What do you mean by vice? Where would I put ContinueLoop? Link to comment Share on other sites More sharing options...
homemade Posted January 5, 2010 Author Share Posted January 5, 2010 Ok if I use ContinueLoop then I get stuck in an infinite loop. Is there a way to have the If condition do 2 things? If $sMail = 0 Then MouseClick("left", 779, 931, 1, 0) AND ContinueLoop I want to do something like that but that gives me an error. Link to comment Share on other sites More sharing options...
omikron48 Posted January 5, 2010 Share Posted January 5, 2010 Did you even bother reading the help file? Coding syntax is in there, you know... If $sMail = 0 Then MouseClick("left", 779, 931, 1, 0) ContinueLoop EndIf Link to comment Share on other sites More sharing options...
JohnOne Posted January 5, 2010 Share Posted January 5, 2010 You might want to take another look at this part of your code also If $sMail AND $sMail = 0 Then 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...
homemade Posted January 6, 2010 Author Share Posted January 6, 2010 Did you even bother reading the help file? Coding syntax is in there, you know... If $sMail = 0 Then MouseClick("left", 779, 931, 1, 0) ContinueLoop EndIf Yes I did. That's how I discovered ContinueLoop and ExitLoop. I looked at the example and it did not show me or tell me about the syntax. Thanks for the help though. Link to comment Share on other sites More sharing options...
omikron48 Posted January 7, 2010 Share Posted January 7, 2010 (edited) Hmm. Apparently the immediately viewable examples (even in the ones in the Keyword/Statement Reference) all contain single statement samples. Guess you don't code much or aren't that exposed to code since it's pretty common knowledge to coders that you can stick however many statements you want inside conditional statements or loops. Edited January 7, 2010 by omikron48 Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 7, 2010 Share Posted January 7, 2010 @homemade: Did you get it figured out? Couldn't really tell if you arrived at a working solution. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
homemade Posted January 8, 2010 Author Share Posted January 8, 2010 Yeah, I came up with a solution thanks to omikron48's example. I am still a newbie and sometimes the example scripts in the help file don't help with more complicated stuff. Thanks for the help everybody! 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