mIRC Home    About    Download    Register    News    Help

Print Thread
How to tell if I'm connected to the internet? #60391
15/11/03 11:01 AM
15/11/03 11:01 AM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
saragani  Offline OP
Fjord artisan
S

Joined: Feb 2003
Posts: 282
Is there a function if mIRC that can tell me if I'm connected to the internet?

Thanks.

Re: How to tell if I'm connected to the internet? #60392
15/11/03 12:07 PM
15/11/03 12:07 PM
Joined: Sep 2003
Posts: 58
Netherlands
S
stimpy Offline
Babel fish
stimpy  Offline
Babel fish
S

Joined: Sep 2003
Posts: 58
Netherlands
I found this in the mIRC help file
Maybe it can help you...


$server
Returns the name of the server to which you are currently connected.

If you're not currently connected to a server, it returns $null.


Good Luck !!!


***************************
To chat, or not to chat.
That's the question
Re: How to tell if I'm connected to the internet? #60393
15/11/03 01:15 PM
15/11/03 01:15 PM
Joined: Nov 2003
Posts: 67
Buenos Aires, Argentina
C
Canario Offline
Babel fish
Canario  Offline
Babel fish
C

Joined: Nov 2003
Posts: 67
Buenos Aires, Argentina
I donīt know that function, i think you must read about sockets.


irc.universochat.net
#escripting
Re: How to tell if I'm connected to the internet? #60394
15/11/03 08:28 PM
15/11/03 08:28 PM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
saragani  Offline OP
Fjord artisan
S

Joined: Feb 2003
Posts: 282
Well, stimpy, this wasn't what I was looking for, but thanks anyway.

I know how to find out if I'm connected to a server(using $status). I wanted to know if there is a way to find out if I'm connected to the internet.

I have created an e-mail script whcih checks for e-mails, and notify me about them. The problem is that if I'm not connected to the internet, it tries to connect to the internet and causes the dial up to show. I want to prevent that.... I want that it would check e-mails only when I'm connected to the internet.

Re: How to tell if I'm connected to the internet? #60395
16/11/03 12:48 AM
16/11/03 12:48 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Iori  Offline
Hoopy frood
I

Joined: Aug 2003
Posts: 1,831
Depends what version of Windows you are running, the below will work on NT (NT4(?),2000,XP,+) but will NOT work on 9x, it simply uses rasdial to check for a Dial-up connection.
Code:
alias findconnect {
  ; use COM to run rasdial & "find" the string "Connected to" in the output, which is written to a file (ras.txt)
  ; this will wait till the above finishes before continuing, but will not freeze mIRC
  var %a = $ticks
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,cmd.exe /c rasdial|find "Connected to">ras.txt,uint,0,bool,true) }

  ; check that ras.txt is more than 0 bytes
  ; if no connection is found it will be empty
  ; if a connection is found it will contain [color:green]Connected to[/color]
  if $file(ras.txt) { echo -a call.your.email.check.from.here }
  .remove ras.txt
}

Re: How to tell if I'm connected to the internet? #60396
16/11/03 09:05 AM
16/11/03 09:05 AM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
saragani  Offline OP
Fjord artisan
S

Joined: Feb 2003
Posts: 282
Ok,

Thank you for your suggestion. shocked