qwertylol Posted April 16, 2007 Share Posted April 16, 2007 #include <Inet.au3> $PublicIP = _GetIP() MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP) I thought this was gonna return something like 192.168.x.x , since I am using a router between my computers and my modem, you know? instead it returned my modem's ip. so, did au3 access an outside server and determined my ip on the router as my "public" ip address? I just wanted the lan up... what went wrong ? Link to comment Share on other sites More sharing options...
evilertoaster Posted April 16, 2007 Share Posted April 16, 2007 sure did- Func _GetIP() Local $ip, $t_ip If InetGet("http://checkip.dyndns.org/?rnd1=" & Random(1, 65536) & "&rnd2=" & Random(1, 65536), @TempDir & "\~ip.tmp") Then $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp")) FileDelete(@TempDir & "\~ip.tmp") $ip = StringTrimLeft($ip, StringInStr($ip, ":") + 1) $ip = StringTrimRight($ip, StringLen($ip) - StringInStr($ip, "/") + 2) $t_ip = StringSplit($ip, '.') If $t_ip[0] = 4 And StringIsDigit($t_ip[1]) And StringIsDigit($t_ip[2]) And StringIsDigit($t_ip[3]) And StringIsDigit($t_ip[4]) Then Return $ip EndIf EndIf If InetGet("http://www.whatismyip.com/?rnd1=" & Random(1, 65536) & "&rnd2=" & Random(1, 65536), @TempDir & "\~ip.tmp") Then $ip = FileRead(@TempDir & "\~ip.tmp", FileGetSize(@TempDir & "\~ip.tmp")) FileDelete(@TempDir & "\~ip.tmp") $ip = StringTrimLeft($ip, StringInStr($ip, "Your ip is") + 10) $ip = StringLeft($ip, StringInStr($ip, " ") - 1) $ip = StringStripWS($ip, 8) $t_ip = StringSplit($ip, '.') If $t_ip[0] = 4 And StringIsDigit($t_ip[1]) And StringIsDigit($t_ip[2]) And StringIsDigit($t_ip[3]) And StringIsDigit($t_ip[4]) Then Return $ip EndIf EndIf SetError(1) Return -1 EndFunc ;==>_GetIP You can see teh addresses it uses... Link to comment Share on other sites More sharing options...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 aw gdi, I called the unfamiliar function knowing only its crappy description from the help file so, how do I find out my lan ip? thanks ! Link to comment Share on other sites More sharing options...
BigDod Posted April 16, 2007 Share Posted April 16, 2007 Try MsgBox(0,"IP Address", @IPAddress1) BTW The help file does say that it returns the public IP address, so please do not call it crappy just because you do not understand what public means. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 16, 2007 Share Posted April 16, 2007 (edited) I do think the help file should mention that using the _GetIP() function causes your computer to talk to an outside web site to get the data. That could be very critical information in some situations. Maybe it's just me, but that looks on casual reading like it should be an internal process, similar to the @IPAddress1 macro. I get that an external IP discovery site is required to see your address outside the NATs and/or Proxies in place, it should just be clearly mentioned in the help file. P.S. I put a topic in Bug Reports to recommend updating the Remarks for _GetIP() in the help file to:RemarksThis only returns the Public IP address of a computer or network (i.e. the public IP on the WAN link of your NAT router). The address is determined by accessing an external IP discovery web site like checkip.dyndns.org or www.whatismyip.com. Edited April 16, 2007 by PsaltyDS 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...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 so how about the lan ip ? thanks ! Link to comment Share on other sites More sharing options...
qwertylol Posted April 16, 2007 Author Share Posted April 16, 2007 I found it under the helpfile in Macro Reference - System Info @IPAddress1 Link to comment Share on other sites More sharing options...
clifox Posted April 16, 2007 Share Posted April 16, 2007 Try MsgBox(0,"IP Address", @IPAddress1) BTW The help file does say that it returns the public IP address, so please do not call it crappy just because you do not understand what public means. You had this answer from 4 hours ago! 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