Jump to content

Recommended Posts

Posted

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

Posted

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.18.0 X86 - SciTE 5.5.7WIN 11 24H2 X64 - Other Examples Scripts

Posted

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 ;)
Posted

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)

Posted

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

Posted

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
Posted

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

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
Posted

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! ;)

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
×
×
  • Create New...