logikal16 Posted June 16, 2005 Share Posted June 16, 2005 expandcollapse popupFunc ResolveIP() InetGet("http://whatismyip.com", "incoming.dat", 1, 1) $contents = "" While @InetGetActive Sleep(50) Wend $file = FileOpen ("incoming.dat", 0) While 1 $contents = $contents & FileRead ($file, 1000) If @error = -1 Then ExitLoop Wend $invalid = 0 While StringLeft ($contents, 4) <> "lbIP" $contents = StringTrimLeft ($contents, 1) $invalid = $invalid + 1 If $invalid = 5000 Then $invalid = 0 MsgBox (0,"","Error retrieving IP address") ExitLoop EndIf Wend If $invalid <> 0 Then $contents = StringTrimLeft ($contents, 21) $letters = "" While StringLeft ($contents, 5) <> "</h1>" $letters = $letters & StringLeft ($contents, 1) $contents = StringTrimLeft ($contents, 1) Wend Return $letters EndIf EndFuncall you need to do is something like the following:$ipaddr = ResolveIP()and you're done!Matt Link to comment Share on other sites More sharing options...
Lazycat Posted June 16, 2005 Share Posted June 16, 2005 This is works. But your external IP should be in the one of @IpAddressX macro. So you can simplify function. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
w0uter Posted June 16, 2005 Share Posted June 16, 2005 (edited) This is works. But your external IP should be in the one of @IpAddressX macro. So you can simplify function.<{POST_SNAPBACK}>External isnt in an macro AFAIK. There is _GetIP (a standard UDF) though.btw lot of your code can be simplified. ill post it after i edited it.[edit] okey this is what is remaining of your code. well nothing really ...still a nice script its even better to use COM + regexp though but thats a bit complicated Func ResolveIP() InetGet("http://whatismyip.com", "incoming.dat", 1) If @error Then Return 0 $contents = FileRead("incoming.dat", FileGetSize('incoming.dat')) FileDelete('incoming.dat') $contents = StringTrimLeft($contents, StringInStr($contents, "lbIP") + 20) $contents = StringLeft($contents, StringInStr($contents, '<') - 1) Return $contents EndFunc;==> ResolveIP() Edited June 16, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
ryeguy Posted June 16, 2005 Share Posted June 16, 2005 You can actually make your script a bit faster by using www.whatismyip.org instead, because that site doesn't require any trimming. Also, a better way of reading the ENTIRE file is like this: $content=FileRead ($file, filegetsize($file)) It will read the exact number of bytes that the file's size is. Link to comment Share on other sites More sharing options...
sanbin Posted June 16, 2005 Share Posted June 16, 2005 (edited) This is works. But your external IP should be in the one of @IpAddressX macro. So you can simplify function.<{POST_SNAPBACK}>;use @IpAddressX Macro get Ip Address :) ;Thanx w0uter MsgBox(64,"Your Ip Address Is",@IpAddress1) Also ThanX logikal16, U give me a fresh idea ! Edited June 16, 2005 by sanbin Link to comment Share on other sites More sharing options...
logikal16 Posted June 16, 2005 Author Share Posted June 16, 2005 (edited) Good ideas, guys... here's the updated script: Func ResolveIP() InetGet("http://www.whatismyip.org", "incoming.dat", 1, 1) While @InetGetActive Sleep(50) WEnd $file = FileOpen ("incoming.dat", 0) $contents = FileReadLine($file) $wAddress = $contents MsgBox(0,"",$wAddress) Return $wAddress EndFunc It's short enough so that it won't take too long to run, but long enough so that other newbies can see what's going on Edited June 16, 2005 by logikal16 Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 17, 2005 Share Posted June 17, 2005 Just so you know... there is a _GetIP() UDF included with AutoIt... It checks 2 sites to be sure that the page hasnt been cached in the proxy server. Look in the help file . JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
w0uter Posted June 17, 2005 Share Posted June 17, 2005 yawn why doesnt anyone read my post.It checks 2 sites to be sure that the page hasnt been cached in the proxy server.<{POST_SNAPBACK}>wrong. it uses the Random to prevent proxy/ISP cache'ing. the 2 sites are just for backup if one fails. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 18, 2005 Share Posted June 18, 2005 Yea what you said :-P been a while since I read it JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
martinszutner Posted July 29, 2008 Share Posted July 29, 2008 This change will resolver problem with router and firewall mask!!!Func ResolveIP() InetGet("http://www.whatismyip.com/automation/n09230945.asp", "incoming.dat", 1, 1) While @InetGetActive Sleep(50) WEnd $file = FileOpen ("incoming.dat", 0) $contents = FileReadLine($file)MsgBox(0, "IP Address", "Your IP Address is: " & $contents) $wAddress = $contents MsgBox(0,"",$wAddress) Return $wAddressEndFunc Link to comment Share on other sites More sharing options...
NELyon Posted July 30, 2008 Share Posted July 30, 2008 I did this before too. I made it to do it with less code than _GetIP, and I made it a UDF.http://www.autoitscript.com/forum/index.ph...c=61360&hl= Link to comment Share on other sites More sharing options...
spyrorocks Posted July 30, 2008 Share Posted July 30, 2008 (edited) #include <INet.au3> func _GetExternalIP() ;Spyrorocks' Simple _GetExternalIP() function. Doesn't get much easier than this. return _INetGetSource ("http://www.whatismyip.org"); endfunc Oh yeah. Edited July 30, 2008 by spyrorocks [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
NELyon Posted July 30, 2008 Share Posted July 30, 2008 #include <INet.au3> func _GetExternalIP() ;Spyrorocks' Simple _GetExternalIP() function. Doesn't get much easier than this. return _INetGetSource ("http://www.whatismyip.org"); endfunc Oh yeah. You just owned everyone who posted in this thread But yours relies on external UDF's. Booyah. Link to comment Share on other sites More sharing options...
spyrorocks Posted July 30, 2008 Share Posted July 30, 2008 External UDFs that are included with autoit, so it really doesn't matter. I don't really ever have a need for external IP addresses, but since you guys were making functions to get them... [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted July 30, 2008 Share Posted July 30, 2008 #include <INet.au3> func _GetExternalIP() ;Spyrorocks' Simple _GetExternalIP() function. Doesn't get much easier than this. return _INetGetSource ("http://www.whatismyip.org"); endfunc Oh yeah. Simplicity rules. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
JRSmile Posted July 30, 2008 Share Posted July 30, 2008 #include <INet.au3> func _GetExternalIP() ;Spyrorocks' Simple _GetExternalIP() function. Doesn't get much easier than this. return _INetGetSource ("http://www.whatismyip.org"); endfunc Oh yeah. Damn, when i read the sources above i wanted th exactly post the same function :-) but you were faster then me. *regards* J. $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
trancexx Posted November 10, 2009 Share Posted November 10, 2009 hi, you don't need to get to a special site like http://www.whatismyip.org i used the following: Func ResolveIP() InetGet("incoming.dat", 1, 1) While @InetGetActive Sleep(50) WEnd $file = FileOpen ("incoming.dat", 0) $contents = FileReadLine($file) $wAddress = $contents Return $wAddress EndFunc You should open 1. Go now and learn more... ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Developers Jos Posted November 10, 2009 Developers Share Posted November 10, 2009 hi, you don't need to get to a special site like http://www.whatismyip.org i used the following: Func ResolveIP() InetGet("incoming.dat", 1, 1) While @InetGetActive Sleep(50) WEnd $file = FileOpen ("incoming.dat", 0) $contents = FileReadLine($file) $wAddress = $contents Return $wAddress EndFunc You are sure this works? Je weet het zeker dat dit werkt? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
sander1991 Posted November 12, 2009 Share Posted November 12, 2009 hahha i already deleted it ^^ i forgot the place some more code xD Link to comment Share on other sites More sharing options...
Splash Posted November 12, 2009 Share Posted November 12, 2009 Look here: http://www.whatismyip.com/automation/n09230945.asp And here: http://forum.whatismyip.com/f14/our-automation-rules-t241/ Igor Cemim Automatic Update UDF - IP Address UDF - WinPcap AutoIt _FindDevice()[font="Verdana"][size="2"]AutoIt Spanish/Brasil/World community!!![/size][/font]Use you wanna a dot.tk domain please use my link: 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