how can I do these actions?
(in windows 8.1)
f12:: ; two functions for 1 key
First time = connect wifi (on)
Second time = disconnect wifi (off)
third = first... and so on.
Thanks in advance!
connect / disconnect wifi with same key(Windows 8.1) Topic is solved
Re: connect / disconnect wifi with same key(Windows 8.1)
Keywords: toggle key + devcon
Good luck
Good luck
Re: connect / disconnect wifi with same key(Windows 8.1)
I can't make the script by myself. My knowledge in AHK is beginner.
Please, help me writing it
(English is not my mother language. Sorry by mistakes)
Please, help me writing it
(English is not my mother language. Sorry by mistakes)
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: connect / disconnect wifi with same key(Windows 8.1) Topic is solved
Guill, try:
Code: Select all
$F12:: ToggleWiFi()
ToggleWiFi() {
wmi := ComObjGet("winmgmts:")
for adapter in wmi.ExecQuery("Select * from Win32_NetworkAdapter")
if InStr(adapter.name, "wireless") && (interfaceName := adapter.NetConnectionID) && status := adapter.NetConnectionStatus
break
if (interfaceName = "" || status = "") {
MsgBox, Failed to get the interfaceName!
return
}
if status not in 0,2 ; Disconnected = 0, Connected = 2
{
Loop {
Sleep, 500
for adapter in wmi.ExecQuery("Select * from Win32_NetworkAdapter Where Index=" . adapter.Index)
status := adapter.NetConnectionStatus
} until status = 0 || status = 2 || (A_Index = 20 && failed := true)
if failed {
MsgBox, Failed to get the status!
return
}
}
Run, % (A_IsAdmin ? "" : "*RunAs ") . "netsh.exe interface set interface name="""
. interfaceName . """ admin="
. (status = 0 ? "en" : "dis") . "abled",, Hide
}
Re: connect / disconnect wifi with same key(Windows 8.1)
Great!!
Thanks a lot, TeaDrinker!
Thanks a lot, TeaDrinker!
Re: connect / disconnect wifi with same key(Windows 8.1)
@teadrinker
Hello, I was using this code for a while but my PC crashed at some point and since then, I have not been able to connect to wifi, could you help out in any way?
Hello, I was using this code for a while but my PC crashed at some point and since then, I have not been able to connect to wifi, could you help out in any way?
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: connect / disconnect wifi with same key(Windows 8.1)
Sorry, I can hardly help remotely. Make sure wifi is turned on via a physical switch, if any. Read this topic.
Re: connect / disconnect wifi with same key(Windows 8.1)
Is it possible to disable it without having to connect to wifi, I mean disable the wifi driver with one f2 key without having to connectteadrinker wrote: ↑11 Nov 2017, 09:40Guill, try:Code: Select all
$F12:: ToggleWiFi() ToggleWiFi() { wmi := ComObjGet("winmgmts:") for adapter in wmi.ExecQuery("Select * from Win32_NetworkAdapter") if InStr(adapter.name, "wireless") && (interfaceName := adapter.NetConnectionID) && status := adapter.NetConnectionStatus break if (interfaceName = "" || status = "") { MsgBox, Failed to get the interfaceName! return } if status not in 0,2 ; Disconnected = 0, Connected = 2 { Loop { Sleep, 500 for adapter in wmi.ExecQuery("Select * from Win32_NetworkAdapter Where Index=" . adapter.Index) status := adapter.NetConnectionStatus } until status = 0 || status = 2 || (A_Index = 20 && failed := true) if failed { MsgBox, Failed to get the status! return } } Run, % (A_IsAdmin ? "" : "*RunAs ") . "netsh.exe interface set interface name=""" . interfaceName . """ admin=" . (status = 0 ? "en" : "dis") . "abled",, Hide }
-
- Posts: 4331
- Joined: 29 Mar 2015, 09:41
- Contact:
Who is online
Users browsing this forum: jaka1, penguinautomator, Spawnova and 238 guests