SumTingWong Posted August 24, 2005 Posted August 24, 2005 how to stop LAN in au3 ? thanks!!! <{POST_SNAPBACK}>In your case, the most effective way would be to pull the plug!
Gigglestick Posted August 24, 2005 Posted August 24, 2005 In your case, the most effective way would be to pull the plug! LOL! @trektaiwanHmmm... What OS? If this is Win2K/XP/2003, you could disable the adapter. I'm sure it could be done with a DLL call, but I don't know which DLL or function. Search the MSDN. Otherwise, you could bring up the network connections control panel, right-click the appropriate one, and hit disable. My UDFs: ExitCodes
Guest trektaiwan Posted August 24, 2005 Posted August 24, 2005 LOL! @trektaiwanHmmm... What OS? If this is Win2K/XP/2003, you could disable the adapter. I'm sure it could be done with a DLL call, but I don't know which DLL or function. Search the MSDN. Otherwise, you could bring up the network connections control panel, right-click the appropriate one, and hit disable.<{POST_SNAPBACK}>maybe ok, but need to get mouse position and right click ...my problem is how to auto stop and auto start LAN at sometime ...
redndahead Posted August 24, 2005 Posted August 24, 2005 I am sure doing "IPConfig /release" would do it. When you want it back run "IPConfig /renew" red
Gigglestick Posted August 24, 2005 Posted August 24, 2005 I am sure doing "IPConfig /release" would do it. When you want it back run "IPConfig /renew"Good call!Man, I can't believe my mind went in such a complicated direction over this! My UDFs: ExitCodes
MSLx Fanboy Posted August 24, 2005 Posted August 24, 2005 I believe that netsh interface set interface "Local Area Connection" disable would do it, else try admin = disable at the end Source: netsh help documentation Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
blindwig Posted August 24, 2005 Posted August 24, 2005 I believe thatnetsh interface set interface "Local Area Connection" disablewould do it, else try admin = disable at the endSource: netsh help documentation<{POST_SNAPBACK}>I think that only works for WAN connections, not LAN conections.I've looked into this before, and I've never been able to find a way to enable and disable NICs programatically. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
SumTingWong Posted August 24, 2005 Posted August 24, 2005 (edited) Here you go: This method uses COM so it needs latest beta to work. expandcollapse popupAutoItSetOption("MustDeclareVars", 1) Dim $sEnableVerb = "En&able" Dim $sDisableVerb = "Disa&ble" ; Usage example _ToggleConnection("Local Area Connection", $sDisableVerb) Func _ToggleConnection($sConnectionName, $sVerb) Local $oShell Local $oControlPanel Local $oFolderItem Local $oNetConnections Local $oConnectionItem Local $oLanConnection Local $oVerbItem Local $oVerb $oShell = ObjCreate("Shell.Application") $oControlPanel = $oShell.Namespace(3) For $oFolderItem In $oControlPanel.Items ; ConsoleWrite($oFolderItem.Name & @LF) ; Look up network connection folder name in control panel If $oFolderItem.Name = "Network Connections" Then $oNetConnections = $oFolderItem.GetFolder ExitLoop EndIf Next If Not IsObj($oNetConnections) Then Return 0 For $oConnectionItem In $oNetConnections.Items ; ConsoleWrite($oConnectionItem.Name & @LF) If $oConnectionItem.Name = $sConnectionName Then $oLanConnection = $oConnectionItem ExitLoop EndIf Next If Not IsObj($oLanConnection) Then Return 0 For $oVerbItem In $oLanConnection.Verbs ; ConsoleWrite($oVerbItem.Name & @LF) If $oVerbItem.Name = $sVerb Then $oVerb = $oVerbItem ExitLoop EndIf Next If Not IsObj($oVerb) Then Return 0 $oVerb.DoIt() ; Needs delay to allow action to complete Sleep(1000) Return 1 EndFunc Edited August 24, 2005 by SumTingWong
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