Jump to content

Disconnect WLAN


Mariah
 Share

Recommended Posts

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 Posted Image

#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.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Try like this Posted Image

#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

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

Hi Matt, how are you? ;)

Yes, I have Service pack 3

Yes, I think windows has control of wireless card

and 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

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

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

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 by MattyD
Link to comment
Share on other sites

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, :shocked: 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...