naru Posted July 23, 2017 Author Posted July 23, 2017 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
naru Posted July 23, 2017 Author Posted July 23, 2017 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 ?
Trong Posted July 23, 2017 Posted July 23, 2017 You do not need to ask, let's test it yourself! Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
naru Posted July 23, 2017 Author Posted July 23, 2017 (edited) 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 July 23, 2017 by Nareshm
naru Posted July 24, 2017 Author Posted July 24, 2017 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now