Jump to content

Script for watching internet connection


malosa
 Share

Recommended Posts

Hi all , 

I have a question: 

Does anyone know a good script that it watch if my internet is still connected ? its for my security system , once in a while my wlan is disconnected /disabled i want a script that watch if internet is gone it disables and enables my internet like this script , only it needs to run constantly and only stop if i press Q .

Its on windows 7

 

#RequireAdmin
ShellExecuteWait("netsh.exe", 'int set interface "Wi-Fi" disable', "", "", @SW_HIDE)

ShellExecuteWait("netsh.exe", 'int set interface "Wi-Fi" enable', "", "", @SW_HIDE)

HotKeySet ("q", "quitme")

Func quitme()

 

Thanks in Advance!

Edited by malosa
Link to comment
Share on other sites

thx , but that is only checking the connection , but if the connection is down i want to put my script into it so it disables and enables my network card like the little script above , and i want that its monitor constantly 

 

 

 

Edited by malosa
Link to comment
Share on other sites

Perhaps you can use the code shown in https://www.autoitscript.com/wiki/Connected as a function in your monitoring script?

Then when connection is down trigger another function rather than showing a message box.

Here's a simple (has to be for me) monitoring-type script:

AdLibRegister("checkSec", 4154)

While 1
    Sleep(10)
WEnd

Func checkSec()
    $seconds = @SEC
    $firstDigit = StringLeft($seconds, 1)
    If $firstDigit = 3 Then
        a()
    EndIf
    If $firstDigit = 5 Then
        b()
    EndIf
EndFunc

Func a()
    MsgBox(0, "", "looks like it was thirty-something" & @CRLF & "sure wish I was", 3)
EndFunc

Func b()
    MsgBox(0, "", "looks like it was fifty-something" & @CRLF & "I know how it feels", 3)
EndFunc
Link to comment
Share on other sites

hello there, I should post my question here coz i dont want to create a new thread like this,

this example is for LAN only,

https://www.autoitscript.com/wiki/Connected

I was searching for WAN do you have any idea where I could get examples for WAN???

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

; https://www.autoitscript.com/autoit3/docs/functions/Ping.htm

#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Ping the AutoIt website with a timeout of 250ms.
    Local $iPing = Ping("autoitscript.com", 250)

    If $iPing Then ; If a value greater than 0 was returned then display the following message.
        MsgBox($MB_SYSTEMMODAL, "", "The roundtrip-time took: " & $iPing & "ms.")
    Else
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred with @error value of: " & @error)
    EndIf
EndFunc

Edited by Spider001
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...