jaweb 0 Posted November 6, 2010 Hi, I use a proxy and sometimes need a specific IP from the Proxy's IP range so I wrote a simple auto #include <Inet.au3> $PublicIP = _GetIP() While 1 If $PublicIP = "***.***.***.***" Then MsgBox(0, "IP Search", "Confirmed", 5) Else MsgBox(0, "IP Search", "Not Found", 5) ControlClick("Proxy App", "", "Change IP Address") Sleep(5000) EndIf Wend The only thing is I'm stuck in a loop. What did I miss? Share this post Link to post Share on other sites
Delta 2 Posted November 6, 2010 (edited) You didn't miss anything. While 1 means to just keep looping. To stop looping you need to add an ExitLoop where you want to break the loop. So you want something like. #include <Inet.au3> $PublicIP = _GetIP() While 1 If $PublicIP = "***.***.***.***" Then MsgBox(0, "IP Search", "Confirmed", 5) ExitLoop ; This will exit the loop Else MsgBox(0, "IP Search", "Not Found", 5) ControlClick("Proxy App", "", "Change IP Address") Sleep(5000) EndIf Wend Edited November 6, 2010 by Deltaforce229 [size="1"]Please stop confusing "how to" with "how do"[/size] Share this post Link to post Share on other sites
supadodger 0 Posted November 6, 2010 (edited) i would do it something like this if it was me. i hate using If statements if i can avoid them. #include <Inet.au3> While _GetIP() <> "***.***.***.***" Sleep(100) Wend ControlClick("Proxy App", "", "Change IP Address") Sleep(5000) Edited November 6, 2010 by supadodger Share this post Link to post Share on other sites
jaweb 0 Posted November 6, 2010 It seems 'while 1' isn't the issue. The IP address _GetIP() gets from whatismyip.com will refresh only if I restart the script. So if I start the script, it will stay in a loop even if the IP is located, For example, Say I want to verify my own ISP assigned IP, if I turn on the proxy (which changes the IP) and start the script, it'll say 'Not Found', because ofcourse my IP was already change by the proxy, but if I turn off the proxy to get back my ISP assigned IP, the script continue to say 'Not Found' because the info _GetIP() gets from whatismyip.com isn't refreshed. In other words, how to get _GetIP() to refresh on every loop? or what are _GetIP() alternatives. Share this post Link to post Share on other sites
AdmiralAlkex 125 Posted November 6, 2010 You have _GetIP() BEFORE the loop, not IN the loop. Think about that. .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 Share this post Link to post Share on other sites
jaweb 0 Posted November 6, 2010 You're Absolutely right. Fixed. Thank You. AdmiralAlkex is AWESOME! Share this post Link to post Share on other sites