Mariah Posted September 26, 2010 Share Posted September 26, 2010 hi everyone.. i want an autoit script to disconnect the wireless network adapter. can someone help me please?? Link to comment Share on other sites More sharing options...
wakillon Posted September 26, 2010 Share Posted September 26, 2010 (edited) hi everyone.. i want an autoit script to disconnect the wireless network adapter. can someone help me please??Hi Mariah ! If you are on WinXP SP3Try the NATIVE WIFI FUNCTIONS by MattyD. Edited September 26, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Mariah Posted September 26, 2010 Author Share Posted September 26, 2010 Hi Mariah ! If you are on WinXP SP3Try the NATIVE WIFI FUNCTIONS by MattyD.Thanks wakillon I checked the link which u sent me,, and it's a lott of code I couldn't figure out the code which will disconnect the wireless adaptor.. i'll really appreciate if you copy the code which does the same.. please.. Link to comment Share on other sites More sharing options...
wakillon Posted September 26, 2010 Share Posted September 26, 2010 Thanks wakillon I checked the link which u sent me,, and it's a lott of code I couldn't figure out the code which will disconnect the wireless adaptor.. i'll really appreciate if you copy the code which does the same.. please.. Try like this #include <Wifi33b.au3> Local $sReturn $avInterfaces = _Wlan_StartSession() If @error Then _ReportError(@ScriptLineNumber, @error, @extended, $avInterfaces) ConsoleWrite("Failed to start wifi session!" & @CRLF) Exit EndIf OnAutoItExitRegister("_ExitAutoIt") $sReturn = _Wlan_DisconnectWait(-1, -1, 5) If @error Then _ReportError(@ScriptLineNumber, @error, @extended, $sReturn) Exit Func _ExitAutoIt() ConsoleWrite("---_Wlan_EndSession()---" & @CRLF) ConsoleWrite("_Wlan_EndSession() should live in an exit function" & @CRLF) _Wlan_EndSession(-1) EndFunc Func _ReportError($iLine, $iError, $iExtended, $sReturn) ConsoleWrite("!Error @ln(" & $iLine & ") err[" & $iError & "] ext[" & $iExtended & "]" & @CRLF) If $sReturn Then ConsoleWrite("!" & $sReturn) EndFunc AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Mariah Posted September 27, 2010 Author Share Posted September 27, 2010 Try like this #include <Wifi33b.au3> Local $sReturn $avInterfaces = _Wlan_StartSession() If @error Then _ReportError(@ScriptLineNumber, @error, @extended, $avInterfaces) ConsoleWrite("Failed to start wifi session!" & @CRLF) Exit EndIf OnAutoItExitRegister("_ExitAutoIt") $sReturn = _Wlan_DisconnectWait(-1, -1, 5) If @error Then _ReportError(@ScriptLineNumber, @error, @extended, $sReturn) Exit Func _ExitAutoIt() ConsoleWrite("---_Wlan_EndSession()---" & @CRLF) ConsoleWrite("_Wlan_EndSession() should live in an exit function" & @CRLF) _Wlan_EndSession(-1) EndFunc Func _ReportError($iLine, $iError, $iExtended, $sReturn) ConsoleWrite("!Error @ln(" & $iLine & ") err[" & $iError & "] ext[" & $iExtended & "]" & @CRLF) If $sReturn Then ConsoleWrite("!" & $sReturn) EndFunc thanks alot wakillon.... i triedd alott but unfortunately I couldn't get this to work Link to comment Share on other sites More sharing options...
wakillon Posted September 27, 2010 Share Posted September 27, 2010 I have tried it on XP and it works well. What OS have you ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Mariah Posted September 27, 2010 Author Share Posted September 27, 2010 I have tried it on XP and it works well.What OS have you ?me too! :s i have XP pro Link to comment Share on other sites More sharing options...
MattyD Posted September 27, 2010 Share Posted September 27, 2010 Hi Mariah,Couple of things to check...Do you have SP3? or SP2 with this?Does Windows have control of your wireless card?What error(s) do the funtions spit out?Cheers,Matt Link to comment Share on other sites More sharing options...
Mariah Posted September 27, 2010 Author Share Posted September 27, 2010 Hi Mariah,Couple of things to check...Do you have SP3? or SP2 with this?Does Windows have control of your wireless card?What error(s) do the funtions spit out?Cheers,MattHi Matt, how are you? Yes, I have Service pack 3Yes, I think windows has control of wireless cardand it doesn't do anything and also doesn't give any error msg.. (the code which wakillon gave me) Link to comment Share on other sites More sharing options...
MattyD Posted September 27, 2010 Share Posted September 27, 2010 Im good thanks! I have a few days off work which is always nice. You should be able to see some output with that code - at least: ---_Wlan_EndSession()--- _Wlan_EndSession() should live in an exit function how do you debug your scripts? just press f5 in SciTE and look at the bottom pane. Matt Link to comment Share on other sites More sharing options...
Mariah Posted September 28, 2010 Author Share Posted September 28, 2010 Im good thanks! I have a few days off work which is always nice. You should be able to see some output with that code - at least: ---_Wlan_EndSession()--- _Wlan_EndSession() should live in an exit function how do you debug your scripts? just press f5 in SciTE and look at the bottom pane. Matt that's great! I hope you have a wonderful time i get the following output: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Admin\Desktop\wifi_disconnect.au3" !Error @ln(6) err[2] ext[0] Failed to start wifi session! >Exit code: 0 Time: 0.478 Link to comment Share on other sites More sharing options...
MattyD Posted September 28, 2010 Share Posted September 28, 2010 ok cool, It seems the API could not find any wireless cards on your system! I take it you had the card enabled in the device manager when you ran it... Link to comment Share on other sites More sharing options...
Mariah Posted September 28, 2010 Author Share Posted September 28, 2010 ok cool,It seems the API could not find any wireless cards on your system!I take it you had the card enabled in the device manager when you ran it...Yes I had the wireless network connection enabled when I ran it.. Link to comment Share on other sites More sharing options...
MattyD Posted September 28, 2010 Share Posted September 28, 2010 (edited) sorry mate, Im running low on ideas... You can try things like restarting the service by typing net stop wzcsvc && net start wzcsvc in the command prompt or rebooting the machine would have the same effect... possibly disabling and renabling the card? Edited September 28, 2010 by MattyD Link to comment Share on other sites More sharing options...
Mariah Posted September 28, 2010 Author Share Posted September 28, 2010 sorry mate, Im running low on ideas... You can try things like restarting the service by typing net stop wzcsvc && net start wzcsvc in the command prompt or rebooting the machine would have the same effect... possibly disabling and renabling the card? thank u so much Matty, there was nothing wrong with ur functions, i found that a third party software was installed which was managing the wireless. I disabled it then i was able to disconnect the WLAN with ur code thanks again i really appreciate it wakillon thank you too! Link to comment Share on other sites More sharing options...
wakillon Posted September 28, 2010 Share Posted September 28, 2010 Cool !Glad to help you ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
MattyD Posted September 29, 2010 Share Posted September 29, 2010 No worries, happy scripting! Matt Link to comment Share on other sites More sharing options...
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