jaweb Posted November 6, 2010 Share 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? Link to comment Share on other sites More sharing options...
Delta Posted November 6, 2010 Share 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] Link to comment Share on other sites More sharing options...
supadodger Posted November 6, 2010 Share 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 Link to comment Share on other sites More sharing options...
jaweb Posted November 6, 2010 Author Share 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. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 6, 2010 Share 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 Link to comment Share on other sites More sharing options...
jaweb Posted November 6, 2010 Author Share Posted November 6, 2010 You're Absolutely right. Fixed. Thank You. AdmiralAlkex is AWESOME! 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