AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking connection?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
dijiyd



Joined: 01 Apr 2004
Posts: 90
Location: Philippines

PostPosted: Sun Jul 18, 2004 10:30 pm    Post subject: Checking connection? Reply with quote

I was wondering if there was any way that you could check if there is an existing internet connection. Thanks.
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Sun Jul 18, 2004 10:47 pm    Post subject: Reply with quote

How about to ping Billy Boy aka www.microsoft.com ?
I guess that won't work without an active internet connection, correct ?

Wink

RunWait, %COMSPEC% /C ping www.microsoft.com > C:\IsTheInternetActiveStatus.txt,, Hide
.
.
.
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Sun Jul 18, 2004 10:52 pm    Post subject: Reply with quote

Another option:

Run, %COMSPEC% /C rasdial /DISCONNECT,,Hide

Well, now you know that there's definitely NO active connection Laughing
Back to top
View user's profile Send private message
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Sun Jul 18, 2004 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Beastmaster



Joined: 15 Apr 2004
Posts: 182

PostPosted: Mon Jul 19, 2004 11:22 am    Post subject: Reply with quote

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
View user's profile Send private message
dijiyd



Joined: 01 Apr 2004
Posts: 90
Location: Philippines

PostPosted: Mon Jul 19, 2004 11:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group