Jump to content

Connect/Disconnect DialUp Internet Without CMD


Recommended Posts

  • Developers

What does that mean?   CMD doesn't take much more time that milliseconds, so what exactly are you running that takes times?

Jos

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

2 minutes ago, Jos said:

What does that mean?   CMD doesn't take much more time that milliseconds, so what exactly are you running that takes times?

Jos

@Jos
Can i post my question/answer in hindi beacause i don't understand english very well

Link to comment
Share on other sites

  • Developers

No as that will not mean  anything to me and we want  to keep this forum English. I am Dutch so English isn't my native language either.

Jos

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

1 minute ago, Jos said:

No as that will not mean  anything to me and we want  to keep this forum English. I am Dutch so English isn't my native language either.

Jos

Okk @Jos sir
i am create script for disconnect my internet then suddenly connect my internet Using Rasdial command, but when disconnect is proccesing connect command run but not connecting beacoz disconnect command already in progress then manualy not connecting my internet until i restart my computer

Link to comment
Share on other sites

:'(

If _IsInternetConnected() Then 
    Run("rasdial /disconnect", "", @SW_HIDE) ; When connected then disconnect
Else
    RunWait("rasdial Internet", "", @SW_HIDE) ; when disconnected then connect
EndIf


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

 

Regards,
 

Link to comment
Share on other sites

2 minutes ago, VIP said:

:'(

If _IsInternetConnected() Then 
    Run("rasdial /disconnect", "", @SW_HIDE) ; When connected then disconnect
Else
    RunWait("rasdial Internet", "", @SW_HIDE) ; when disconnected then connect
EndIf


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
But its Working like

Run("rasdial /disconnect", @ScriptDir, @SW_HIDE)
Run("rasdial Internet", @ScriptDir, @SW_HIDE)

I Need Script for
Disconnect internet for 1 second

Explain : Connect immediately after disconnecting the internet
If not connected then only connect

Link to comment
Share on other sites

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

 

Regards,
 

Link to comment
Share on other sites

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

 

Regards,
 

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...