Jump to content

Connect/Disconnect DialUp Internet Without CMD


Recommended Posts

3 minutes ago, VIP said:

It's beyond my reach!
If you want to disconnect in just 1 second, you can quickly remove the dial-up modem plugged in to your computer!

This script will help keep you connected:

RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
Sleep(1000)
RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again

Global $iError = 0, $iMaxErrorToRestartConnect = 10

While 1
    If Not _IsInternetConnected() Then
        $iError += 1
        RunWait("rasdial Internet", "", @SW_HIDE)
        If $iError > $iMaxErrorToRestartConnect Then RunWait("rasdial /disconnect", "", @SW_HIDE)
    EndIf
    Sleep(1000)
WEnd

Func _IsInternetConnected()
    Local $aReturn = DllCall('connect.dll', 'long', 'IsInternetConnected')
    If @error Then Return SetError(1, 0, 0)
    Return ($aReturn[0] = 0)
EndFunc   ;==>_IsInternetConnected

 

Disconnect in 1 second means immedetly connect after disconnect (Pause internet for 1 second)

Sorry for my bad english

Link to comment
Share on other sites

8 minutes ago, VIP said:

Forgot restart error:

RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
Sleep(1000)
RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again

Global $iError = 0, $iMaxErrorToRestartConnect = 10

While 1
    If Not _IsInternetConnected() Then
        $iError += 1
        RunWait("rasdial Internet", "", @SW_HIDE)
        If $iError > $iMaxErrorToRestartConnect Then
            RunWait("rasdial /disconnect", "", @SW_HIDE)
            $iError = 0
            Sleep(5000)
        EndIf
    EndIf
    Sleep(1000)
WEnd

Func _IsInternetConnected()
    Local $aReturn = DllCall('connect.dll', 'long', 'IsInternetConnected')
    If @error Then Return SetError(1, 0, 0)
    Return ($aReturn[0] = 0)
EndFunc   ;==>_IsInternetConnected

 

Thanks @VIP it working great
Can i remove sleep time ?

Link to comment
Share on other sites

3 minutes ago, VIP said:

You do not need to ask, let's test it yourself!

Yes its working great, But script not exit it show in tray

Thank you so much @VIP

 

 

 

 

Edited by Nareshm
Link to comment
Share on other sites

21 hours ago, VIP said:

Forgot restart error:

RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
Sleep(1000)
RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again

Global $iError = 0, $iMaxErrorToRestartConnect = 10

While 1
    If Not _IsInternetConnected() Then
        $iError += 1
        RunWait("rasdial Internet", "", @SW_HIDE)
        If $iError > $iMaxErrorToRestartConnect Then
            RunWait("rasdial /disconnect", "", @SW_HIDE)
            $iError = 0
            Sleep(5000)
        EndIf
    EndIf
    Sleep(1000)
WEnd

Func _IsInternetConnected()
    Local $aReturn = DllCall('connect.dll', 'long', 'IsInternetConnected')
    If @error Then Return SetError(1, 0, 0)
    Return ($aReturn[0] = 0)
EndFunc   ;==>_IsInternetConnected

 

@VIP
It was not working anymore because it was not exit after disconnect and connect.
I need script for :  Connect immediately after disconnecting the internet
If not connected then only connect, then exit script not pause it was paused in tray, When i click on it again do same process again.

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

×
×
  • Create New...