 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
dijiyd
Joined: 01 Apr 2004 Posts: 90 Location: Philippines
|
Posted: Sun Jul 18, 2004 10:30 pm Post subject: Checking connection? |
|
|
| I was wondering if there was any way that you could check if there is an existing internet connection. Thanks. |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 182
|
Posted: Sun Jul 18, 2004 10:47 pm Post subject: |
|
|
How about to ping Billy Boy aka www.microsoft.com ?
I guess that won't work without an active internet connection, correct ?
RunWait, %COMSPEC% /C ping www.microsoft.com > C:\IsTheInternetActiveStatus.txt,, Hide
.
.
. |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 182
|
Posted: Sun Jul 18, 2004 10:52 pm Post subject: |
|
|
Another option:
Run, %COMSPEC% /C rasdial /DISCONNECT,,Hide
Well, now you know that there's definitely NO active connection  |
|
| Back to top |
|
 |
Jon
Joined: 28 Apr 2004 Posts: 373
|
Posted: Sun Jul 18, 2004 11:15 pm Post subject: |
|
|
One way would be to tell it download a file and then check if the file exists. If it doesn't then you havn't got an internet connection. Best to download a very small file though such as a webpage.
Another is to use the variable A_IPAddress1 through 4. One of these will be different when you are connected to the internet from when you are offline. |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 182
|
Posted: Mon Jul 19, 2004 11:22 am Post subject: |
|
|
| Quote: | PhonebookEntry = "Name Of My Phonebook Entry"
TMPFile = C:\DialUpStatus.txt
RunWait, %COMSPEC% /C rasdial "%PhonebookEntry%" > %TMPFile%,,Hide
FileReadLine, Line, %TMPFile%, 3
FileDelete, %TMPFile%
IfNotInString, Line, error
{
MsgBox, Connected !
}
Else
{
MsgBox, No connection!
}
Exit |
| Quote: | Run, %COMSPEC% /C Rasphone -s,,Hide
WinWaitActive, Dial-Up Networking Monitor
WinMove, Dial-Up Networking Monitor,, 0, 716, 222, 24
ControlFocus, Edit1, Dial-Up Networking Monitor
ControlGetText, OutputVar,Edit1, Dial-Up Networking Monitor
MsgBox, %OutputVar%
WinClose, Dial-Up Networking Monitor
Exit |
|
|
| Back to top |
|
 |
dijiyd
Joined: 01 Apr 2004 Posts: 90 Location: Philippines
|
Posted: Mon Jul 19, 2004 11:28 am Post subject: |
|
|
| Thanks. The IP addresses work fine. I guess it would have helped to have some clarification. I was trying to create a script that would run some programs while I'm away from home. I have a frequent disconnection problem, so I need to check whether I was online every few ticks then run the programs. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|