naru Posted July 23, 2017 Posted July 23, 2017 its possible to Connect/Disconnect my DialUp internet connection without using CMD ? If yes, How to it ?
Developers Jos Posted July 23, 2017 Developers Posted July 23, 2017 Why without using CMD? 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.
Gianni Posted July 23, 2017 Posted July 23, 2017 ?? maybe this: ShellExecute("rasdial", "/disconnect") Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
naru Posted July 23, 2017 Author Posted July 23, 2017 29 minutes ago, Jos said: Why without using CMD? Jos CMD takes long time to connect/Disconnect
Developers Jos Posted July 23, 2017 Developers Posted July 23, 2017 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.
naru Posted July 23, 2017 Author Posted July 23, 2017 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
Developers Jos Posted July 23, 2017 Developers Posted July 23, 2017 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.
naru Posted July 23, 2017 Author Posted July 23, 2017 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
Developers Jos Posted July 23, 2017 Developers Posted July 23, 2017 Which script ? Post it! 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.
naru Posted July 23, 2017 Author Posted July 23, 2017 7 minutes ago, Jos said: Which script ? Post it! Jos @Jos Please wait i am busy in my onther work sorry for that
naru Posted July 23, 2017 Author Posted July 23, 2017 @Jos Run("rasdial /disconnect") Run("rasdial Internet")
TheDcoder Posted July 23, 2017 Posted July 23, 2017 Run("rasdial /disconnect", @ScriptDir, @SW_HIDE) Run("rasdial Internet", @ScriptDir, @SW_HIDE) EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
naru Posted July 23, 2017 Author Posted July 23, 2017 2 minutes ago, TheDcoder said: Run("rasdial /disconnect", @ScriptDir, @SW_HIDE) Run("rasdial Internet", @ScriptDir, @SW_HIDE) @TheDcoder after disconnect it was not connecting When connected then run script only disconnect when disconnected then run script only connect
TheDcoder Posted July 23, 2017 Posted July 23, 2017 I don't know how rasdial works, I have only showed you the example to hide the CMD window EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion
naru Posted July 23, 2017 Author Posted July 23, 2017 1 minute ago, TheDcoder said: I don't know how rasdial works, I have only showed you the example to hide the CMD window Okk Thanks
Trong Posted July 23, 2017 Posted July 23, 2017 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 Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
naru Posted July 23, 2017 Author Posted July 23, 2017 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 secondExplain : Connect immediately after disconnecting the internet If not connected then only connect
Gianni Posted July 23, 2017 Posted July 23, 2017 ??? insert a pause between disconnection & reconnection ? Run("rasdial /disconnect", @ScriptDir, @SW_HIDE) Sleep(5000) ; pause 5 seconds Run("rasdial Internet", @ScriptDir, @SW_HIDE) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Trong Posted July 23, 2017 Posted July 23, 2017 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 Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
Trong Posted July 23, 2017 Posted July 23, 2017 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 Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal
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