twine01 0 Posted November 18, 2015 Report Share Posted November 18, 2015 In my script, I have a Loop While command that executes so long as an element exists on the page. After completing a Google search, the script scrapes an element from the page and adds it to a table. The problem I'm running into is that the Loop does not stop immediately when the 'While' condition fails. For example: set(#smoothSailing,$true,"Global")loop while(#smoothSailing) { type text(<username field>,"Smooth Sailing is True","Standard") set(#smoothSailing,$false,"Local") type text(<about me textarea>,"This should not be entered since smoothSailing was set to false.","Standard")} It appears the Loop While command only does the 'While' check at the beginning of the loop, it does not do the check while the loop is running. Is there any way to stop a loop immediately when a condition is no longer true? I tried using the 'return' command, however that will not only stop the current loop but it also stops the parent loop, which is not what I want. Any help or direction on how to stop a loop immediately would be very much appreciated! Quote Link to post Share on other sites
pash 504 Posted November 18, 2015 Report Share Posted November 18, 2015 Be difficultUnless you kill Thread (using plugins).Likewise, there is a simple solution, but it may take several lines of code.Is the division of work. set(#smoothSailing,$true,"Global") loop while(#smoothSailing) { if(#smoothSailing) { then { type text(<username field>,"Smooth Sailing is True","Standard") } else { } } set(#smoothSailing,$false,"Local") if(#smoothSailing) { then { type text(<about me textarea>,"This should not be entered since smoothSailing was set to false.","Standard") } else { } } } 1 Quote Link to post Share on other sites
twine01 0 Posted November 18, 2015 Author Report Share Posted November 18, 2015 Thanks a lot Pash! It's very much appreciated! In the end, my solution was a combination of 'Loop While' and 'If', which is pretty much what you suggested. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.