Sign in to follow this  
Followers 0
Mariah

Disconnect WLAN

17 posts in this topic

hi everyone.. i want an autoit script to disconnect the wireless network adapter. can someone help me please??

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hi everyone.. i want an autoit script to disconnect the wireless network adapter. can someone help me please??

Hi Mariah ! Posted Image

If you are on WinXP SP3

Try the NATIVE WIFI FUNCTIONS by MattyD.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Hi Mariah ! Posted Image

If you are on WinXP SP3

Try 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..

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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 ;)

Share this post


Link to post
Share on other sites

I have tried it on XP and it works well.

What OS have you ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I have tried it on XP and it works well.

What OS have you ?

me too! :s i have XP pro

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by MattyD

Share this post


Link to post
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! ;)

Share this post


Link to post
Share on other sites

Cool !

Glad to help you ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

No worries,

happy scripting!

Matt

Share this post


Link to post
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
Sign in to follow this  
Followers 0