GodlessSinner Posted June 29, 2010 Posted June 29, 2010 Hi. I have 2 connections (not physical - ...Control panel/Connections) and need to switch between them every night. Is there a way to do it programatically (desired without MouseClicks)? Main problem - target OS is 7. Thanks. _____________________________________________________________________________
PsaltyDS Posted June 29, 2010 Posted June 29, 2010 Do you mean different named configs for the network connection? Maybe NETCFG.EXE? Not sure what "Control panel/Connections" means. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
GodlessSinner Posted June 29, 2010 Author Posted June 29, 2010 (edited) netcfg.exe doesn't work. (win 7 64-bit) Edited June 29, 2010 by GodlessSinner _____________________________________________________________________________
GodlessSinner Posted June 30, 2010 Author Posted June 30, 2010 Does anybody know? _____________________________________________________________________________
GodlessSinner Posted July 3, 2010 Author Posted July 3, 2010 I found this code, but it allows to toggle Local connections only:( _ToggleNetworkInterface('Intertelecom', 1) ; $iFlag = 0 Disable network interface ; $iFlag = 1 Enable network interface Func _ToggleNetworkInterface($strNetwork, $iFlag = 1) Local $wbemFlagReturnImmediately = 0x10 Local $wbemFlagForwardOnly = 0x20 Local $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $objItem.NetConnectionID = $strNetwork Then If $iFlag = 0 And $objItem.NetEnabled = True Then $objItem.Disable ElseIf $iFlag = 1 And $objItem.NetEnabled = False Then $objItem.Enable EndIf ExitLoop EndIf Next Else MsgBox(0, "WMI Output", "No WMI Objects Found for class: " & "Win32_NetworkAdapter") EndIf EndFunc ;==>_ToggleNetworkInterface _____________________________________________________________________________
GodlessSinner Posted July 16, 2010 Author Posted July 16, 2010 Does anybody know how? Target language(Autoit, VB, C++, C#) not matter! Just can't find no one example, that works under 7. This is CLSID for Connections Folder ::{7007ACC7-3202-11D1-AAD2-00805FC1270E} How can it be used in Autoit to get the final goal - I don't know:( _____________________________________________________________________________
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