Simple Script to Find My IP Address
Keywords: IP Address
Question:
This script creates a socket and then looks up what my Ip Address is from that socket. It keeps looping until it finds it and then displays it with a message window.Answer:
Option #1:The Ip Grabber Extender function ipGetAddress returns a doubly-delimited list of all IP addresses found along with other related information.Option #2:
;98/08/04 John Henry Miller ;jhmiller@mindless.com ;Script to keep checking (looping) looking for my IP Address ;Once IP Address is established, it is displayed in a window and script is terminated. AddExtender("WWWSK34I.DLL") host="ftp.execpc.com" :Start GoSub GetIpAddress If IpAddress!=0 ;IpAddress!=0 then we are on Internet so let's tell the world and quit looking. Message("Now on Internet!", "My IP Address is %IpAddress%") Exit Else ;IpAddress==0 then we are not yet on Internet, so don't do anything but keep looking. EndIf ;Put in a little delay to free up CPU time. TimeDelay(5) GoTo Start :GetIpAddress :ConnectToHost ;Get the Ip Address for this machine by opening and connecting a socket to a known host. talksocket=sOpen() status=sConnect(talksocket,"%host%","ftp") ;This is where we get the IpAdress with the Socket number. IpAddress=wxGetInfo(1,talksocket) ;Find the colon which is the charecter used to ;parse the Ip Adress from the Socket Number. colon= StrIndex(IpAddress, ":", 0, @FWDSCAN)-1 ;Strip off the Socket Number. IpAddress=StrSub(IpAddress, 1, colon) ;All done with this Socket sClose(talksocket) Return
Article ID: W13797Filename: Simple Script to Find My IP Address.txt