| View previous topic :: View next topic |
| Author |
Message |
nickromano
Joined: 28 Nov 2007 Posts: 25 Location: USA
|
Posted: Wed Nov 28, 2007 10:02 pm Post subject: IP Address |
|
|
I thought this might be useful to someone. It finds the IP address of the computer it is run on.
| Code: | UrlDownloadToFile, http://whatismyipaddress.com/, ip.txt
Loop, read, ip.txt
{
if a_loopreadline contains Your ip address is
ipaddress = %a_loopreadline%
}
StringTrimLeft, ipaddress, ipaddress, 47
Loop
{
if ipaddress contains <
stringtrimright, ipaddress, ipaddress, 1
else
break
}
Msgbox, %ipaddress%
|
|
|
| Back to top |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 122
|
Posted: Wed Nov 28, 2007 10:13 pm Post subject: |
|
|
| Code: | | MsgBox, % A_IPAddress1 |  _________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
nickromano
Joined: 28 Nov 2007 Posts: 25 Location: USA
|
Posted: Wed Nov 28, 2007 10:15 pm Post subject: |
|
|
| haha how did i not know that? |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3941 Location: Pittsburgh
|
Posted: Wed Nov 28, 2007 10:31 pm Post subject: |
|
|
| These are different things. A_IPAddress1 shows the LAN address, most of the time something like 192.168.1.4, but nickromano's script tells the IP address seen from outside of the LAN, like 24.138.252.79 |
|
| Back to top |
|
 |
vapor2
Joined: 11 Sep 2007 Posts: 4
|
Posted: Wed Nov 28, 2007 10:32 pm Post subject: |
|
|
nickromano, Your version is useful if you wanted to discover your "Internet" IP address if your host was behind a firewall with NAT.
-V- _________________ Vapor2 |
|
| Back to top |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 122
|
Posted: Wed Nov 28, 2007 10:38 pm Post subject: |
|
|
| Laszlo wrote: | | These are different things. A_IPAddress1 shows the LAN address, most of the time something like 192.168.1.4, but nickromano's script tells the IP address seen from outside of the LAN, like 24.138.252.79 | Ahh yes; I hadn't taken various network setups into consideration  _________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
maximo3491
Joined: 10 Feb 2007 Posts: 64
|
Posted: Thu Nov 29, 2007 6:32 am Post subject: |
|
|
| Code: | UrlDownloadToFile, http://checkip.dyndns.org/, %A_Temp%\ip.txt
FileRead, ip, %A_Temp%\ip.txt
RegExMatch(ip, "[\d\.]+", ip)
filedelete, %A_Temp%\ip.txt |
This does the same thing but faster without the trimming. The ip is stored within the variable 'ip'. |
|
| Back to top |
|
 |
pinkfloyd232
Joined: 30 Nov 2007 Posts: 2
|
Posted: Fri Nov 30, 2007 4:46 am Post subject: |
|
|
neat script. It's basic. but I'll look into this further when completing my false Auto program for runescape. cool  _________________ Current Projects
Finance Manager
FTP Client
Instant Messenger
File Sniffer
Project Organizer |
|
| Back to top |
|
 |
pinkfloyd232
Joined: 30 Nov 2007 Posts: 2
|
Posted: Fri Nov 30, 2007 5:13 am Post subject: |
|
|
Try using IfNotExist before UrlDownload, and IfExist after UrlDownload. It'll also speed up the script. Assuming you don't want to delete the text file. _________________ Current Projects
Finance Manager
FTP Client
Instant Messenger
File Sniffer
Project Organizer |
|
| Back to top |
|
 |
Wibumba (not logged in) Guest
|
Posted: Fri Nov 30, 2007 9:44 pm Post subject: |
|
|
| Code: | UrlDownloadToFile, http://www.whatismyip.org/, %A_Temp%\ip.txt
FileRead, ip, %A_Temp%\ip.txt
FileDelete, %A_Temp%\ip.txt |
whatismyip.org only displays the address. |
|
| Back to top |
|
 |
helfee
Joined: 10 Aug 2007 Posts: 1
|
Posted: Mon Dec 03, 2007 7:57 am Post subject: |
|
|
| Code: | RunWait, %comspec% /c ipconfig>ip.txt,%temp%,hide
FileRead,ipa,%temp%\ip.txt
FileDelete,%temp%\ip.txt
spot=1
loop
{
pos := RegExMatch(ipa, "((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)",ip,spot)
StringSplit, t, ip,.
if (t1=192 or t1=255)
{
spot:=pos+4
CONTINUE
}
break
}
MsgBox % ip |
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3941 Location: Pittsburgh
|
Posted: Mon Dec 03, 2007 4:45 pm Post subject: |
|
|
| Don't you expect top get the same as A_IPAddress1..4? In my Vista the MsgBox is empty, though. |
|
| Back to top |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 156 Location: Shigle Springs
|
Posted: Fri Dec 07, 2007 4:33 am Post subject: |
|
|
if you have access to a web server, make a file "ip.asp"
in the file put this,
| Code: | <%
Dim sIPAddress
sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If sIPAddress="" Then sIPAddress = Request.ServerVariables("REMOTE_ADDR")
Response.Write sIPAddress
%> |
The web sites listed here will only let you do it once and may not be reliable.
If you want, you can use mine, http://www.virusSWAT.com/ip.asp _________________ CPULOCK
virusSWAT
Guaranteed PC
911 PC FIX |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5574
|
Posted: Fri Dec 07, 2007 4:37 am Post subject: |
|
|
That is nice! Maybe Titan can consider this for autohotkey.net.
 |
|
| Back to top |
|
 |
DeWild1
Joined: 30 Apr 2006 Posts: 156 Location: Shigle Springs
|
Posted: Fri Dec 07, 2007 5:07 am Post subject: |
|
|
| Skan wrote: | That is nice! Maybe Titan can consider this for autohotkey.net.
 |
LOL, I forgot, http://www.autohotkey.com/forum/viewtopic.php?t=19438 , I have never used it but it should work..
I may be wrong, Chris does not allow PHP and I do not know if asp will work or if it is even allowed.
I am not changing mine, so you're free to use it or do http://zendurl.com/
I only did my own because the first link given, their web page may change, the second one only lets you do it once. _________________ CPULOCK
virusSWAT
Guaranteed PC
911 PC FIX |
|
| Back to top |
|
 |
|