Assign the variable sConnection to the target connection name in the script.
And, assign the variable bEnable to 0 to disable the connection.
PS. Tested only in XPSP2!
And, as the Verbs are language-dependent, it may not work in other than English version.
Then, please try to replace the accelerator keys, &A and &B, in the script with the appropriate ones.
Need CoHelper.ahk.
#Include CoHelper.ahk NetConnect(0) Sleep, 5000 NetConnect(1) NetConnect(bEnable = False, sConnection = "Local Area Connection") { CoInitialize() psh := ActiveXObject("Shell.Application") pns := Invoke_(psh, "Namespace", 3, CSIDL_Connections:=0x0031) pitems := Invoke(pns, "Items") Loop, % Invoke(pitems, "Count") { pid := Invoke_(pitems, "Item", 3, A_Index-1) If (Invoke(pid, "Name") = sConnection) { bRes := True Break } Release(pid) } If !bRes ExitApp pverbs := Invoke(pid, "Verbs") pvb := Invoke_(pverbs, "Item", 3, nVB:=0) If pvb { sVerbName := Invoke(pvb, "Name") If (bEnable && InStr(sVerbName, "&a")) || (!bEnable && InStr(sVerbName, "&b")) ; &a and &b can be Language dependent. Invoke(pvb, "DoIt") WinWait, %sConnection% ahk_class #32770,, 1 WinWaitClose Release(pvb) } Release(pverbs) Release(pid) Release(pitems) Release(pns) Release(psh) CoUninitialize() }