mIRC Homepage
Posted By: Cyrex $isconn Identifier - 19/07/04 05:10 PM
How about adding an identifier called $isconn? This would return $true if you are connected to the internet, and $false if you are not.
Posted By: Iori Re: $isconn Identifier - 22/07/04 10:26 AM
If you're talking about "connected to the internet" via a dialup account and you're using WinNT.
Code:
isconn {
  var %a = $ticks
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,cmd /c rasdial|find "Connected to">ras.txt,uint,0,bool,true) }
[color:gray]  ; check the size of ras.txt
  ; if a connection was found it will contain Connected to
  ; if no connection was found it will be empty[/color]
  var %a = $file(ras.txt)
  .remove ras.txt
[color:gray]  ; return the value of %a, if it is zero you are not connected[/color]
  return %a
}
Posted By: Cyrex Re: $isconn Identifier - 22/07/04 04:34 PM
Actually, I was talking about an I identifier that would work on connections other than just Dial-up. I know for a fact this is possible, because I've seen source code for it in other programming languages that check if all types of connections are connected to the internet. The code you posted is just limited to Dial-up connections, so it would be useless to non Dial-up users. And just because someone is using broadband doesn't always mean they are connected to the internet. Their ISP could be experiencing problems, so the user would not be connected to the internet. This is where the $isconn identifier comes in handy.
Posted By: Jae Re: $isconn Identifier - 24/07/04 08:51 PM
There's always a traceroute.... if u can do one to ure isp's homepage.. (which yesi know you have to get ..) but maybe somethin similar may work..
© mIRC Discussion Forums