| View previous topic :: View next topic |
| Author |
Message |
jaco0646 Guest
|
Posted: Mon Mar 13, 2006 2:48 am Post subject: Global IP ? |
|
|
There's probably an easy way to do this that I'm missing: how can I get my global IP address? %A_IPAddress1% only returns the local. Is there a command line program that retrieves it perhaps? IPconfig.exe only returns the local as well.
I could use 'URLDownloadToFile' to check a webpage for it, but that's a last resort. |
|
| Back to top |
|
 |
ggirf14
Joined: 01 Nov 2005 Posts: 96 Location: Ottawa
|
Posted: Mon Mar 13, 2006 3:19 am Post subject: |
|
|
What is global IP address???
Are you looking for your MAC address?, Your "public" network card address?
The following will get you at the root of C a file called "output" with the info about all of your network cards.
Run, cmd.exe
Sleep, 100
Send, ipconfig /all > c:\outputfile.txt {enter}
Sleep, 3000
Send, exit {enter} |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Mon Mar 13, 2006 3:55 am Post subject: |
|
|
Dear jaco0646,
The following lines of AHK code will retrieve the "External IP Address"
1) You should be connected to the Internet else it will show 0.0.0.0
2) It consumes mere 505 bytes of Bandwidth
| Code: | MyExternalIP=0.0.0.0
TmpFile=%WinDir%\TEMP\IPAddress.TMP
UrlDownloadToFile,http://www.whatismyip.org/,%TmpFile%
FileReadLine,MyExternalIP,%TmpFile%,1
FileDelete,%TmpFile%
Msgbox,64,External IP Address,%MyExternalIP% |
I hope this of some help!
Regards,  _________________
 |
|
| Back to top |
|
 |
jaco0646 Guest
|
Posted: Mon Mar 13, 2006 3:55 am Post subject: answer |
|
|
| I found my answer here. Apparently my last resort is my only resort. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Mon Mar 13, 2006 4:11 am Post subject: |
|
|
But jaco0646, did you try my code?! _________________
 |
|
| Back to top |
|
 |
jaco0646 Guest
|
Posted: Mon Mar 13, 2006 4:13 am Post subject: ... too slow |
|
|
Goyyah, you beat me to it! 'URLDownloadToFile' is indeed the only answer I could find. Thanks for the web link; your code works perfectly! |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Mon Mar 13, 2006 9:15 am Post subject: |
|
|
I found a similar script (at a time I forget to write down where I get these tips) in this forum and kept it as I find it convenient.
It is basically the same as Goyyah's one, but since it uses a different address, I give it here (Internet resources are never permanent...):
| Code: | ;----------------------------------------------------------------
;--- Ctrl+Alt+I: show IP address
^!i::
ipFile = %TEMP%\IP
; Use Netikus service, simple and straight to the point...
URLDownloadToFile http://www.netikus.net/show_ip.html, %ipFile%
If ErrorLevel = 1
{
MsgBox 16, IP Address, Your public IP address could not be detected.
}
Else
{
FileReadLine ip, %ipFile%, 1
MsgBox 64, IP Address, Your public IP address is: %ip%`n`nYour private IP address is: %A_IPAddress1%
}
FileDelete %ipFile%
Return
|
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Mon Mar 13, 2006 5:13 pm Post subject: |
|
|
Dear PhiLho,
| PhiLho wrote: | | Internet resources are never permanent... |
Very true ... Thanks for the URL!
The original post is Get current external IP Address
I googled and viewed more than 50 links before I could post it there!
Regards,  _________________
 |
|
| Back to top |
|
 |
skygt
Joined: 15 Mar 2006 Posts: 47 Location: Lille, France
|
Posted: Wed Mar 15, 2006 9:38 pm Post subject: |
|
|
instead of ipconfig try:
ipconfig all
or
ipconfigall
it shows more than 1 ip adresse
Hope it helps!
if you have a router you can type a local ip adresse in the browser
and should see somewhere a link showing all your ip adresses |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Mar 16, 2006 11:46 am Post subject: |
|
|
That's ipconfig /all (see second post), and it doesn't show the "global" (public, known by Internet servers) IP address.
I am not sure about your second trick, even less if you run some Web server... Perhaps it works with some routers. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
skygt
Joined: 15 Mar 2006 Posts: 47 Location: Lille, France
|
Posted: Thu Mar 16, 2006 5:39 pm Post subject: |
|
|
Oh ok sorry then
At least i tryed helping
And yes some routers can let you look at all your stuff
Like Linksys and D-link |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 664 Location: MN, USA
|
Posted: Sat Oct 28, 2006 4:12 pm Post subject: bad URL |
|
|
This URL no longer works for me: http://www.whatismyip.org/ It generates the following error message:
Error: blank User-Agent header is not allowed! Please ask the author of your IP address checking client to specify their client's name in the User-Agent header
I have no idea what the error means; but I thought it might be of interest to Chris as far as how the UrlDownloadToFile command functions and possibly changing it to avoid this. Can AHK specify a "User-Agent header?"
The second URL is still working: http://www.netikus.net/show_ip.html
What was that about Internet resources... ?  _________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Sat Oct 28, 2006 4:18 pm Post subject: Re: bad URL |
|
|
Both the URL's work properly for me!
Windows 2000 SP6 Internet Explorer 6
 _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sat Oct 28, 2006 4:37 pm Post subject: Re: bad URL |
|
|
| Goyyah wrote: | Both the URL's work properly for me!
Windows 2000 SP6 Internet Explorer 6 | IE 6 has a valid user agent, that's why it works...
I doubt UrlDownloadToFile can be changed to give a UA. Using cURL can be an alternative. Or just use a less picky service... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Sat Oct 28, 2006 4:43 pm Post subject: Re: bad URL |
|
|
| PhiLho wrote: | | IE 6 has a valid user agent, that's why it works... |
Thanks! I should not have used the browser to check it!  _________________
 |
|
| Back to top |
|
 |
|