Jump to content

Check If Computer Is Online


Recommended Posts

  • Developers

Maybe this threat is what you are looking for ? http://www.hiddensoft.com/forum/index.php?...findpost&p=8244

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

OK ... understand what you meand now...

Could you check the @IPAddress1 thru @IPAddress4 to see if it gets and address assigned from you ISP ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

here we are (untested)

Edit: Tested! I inverted the 0 and the 1, ops... Now works. :whistle:

Func _IsThisComputerConnected()

; A function to know if a computer is connected or not.
; Returns
; 0 if the computer is Offline
; 1 if the computer is Online

Local $ping
Local $computername

$computername = "www.altavista.com";----Altavista seems a good computer to check... :)

; Changed -w to 5000 because a "out-of-LAN" computer can need more time.
RunWait(@comspec & " /c ping "& $computername &" -n 1 -w 5000>"& @tempdir &"\ping.tmp","",@sw_hide)
$ping = FileReadLine(@tempdir &"\ping.tmp",13)
FileDelete(@tempdir &"\ping.tmp")
If StringInStr($ping,"(0%") Then
   Return 1
Else
   Return 0
EndIf
EndFunc
Edited by ezzetabi
Link to comment
Share on other sites

You are forgetting an important, but easy to miss, fact that someone's computer may be behind a proxy. Then the ping command would never be successfull...it's not for me.

There is an API command for getting internet connection status.

Edited by MattNis

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Link to comment
Share on other sites

There is an API call to check if computer is connected to the internet.

Any plans on incorporating it?

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...