Skip to content

Instantly share code, notes, and snippets.

@mark05e
Last active May 16, 2024 16:37
Show Gist options
  • Save mark05e/cd2e8b9981b675cd8b5975ab34111d84 to your computer and use it in GitHub Desktop.
Save mark05e/cd2e8b9981b675cd8b5975ab34111d84 to your computer and use it in GitHub Desktop.
AHK Script with GUI to enable/disable proxy. Works on Win10 too!
; my_ie_proxy.ahk
;#################################################################################
; Enable/Disable IE Proxy with GUI
;#################################################################################
; ref: //autohotkey.com/board/topic/101854-switch-proxy-on-or-off/?p=634033
global AddressPort = "proxy.myproxyprovider.com:1234"
Gui, Add, Text, x20 cBlue, %AddressPort%
Gui, Add, Button, x26 y20 w100 h30 Gon , I'm at work
Gui, Add, Button, x26 y60 w100 h30 Goff , I'm at home
Gui, Show, x129 y99 h100 w154, Proxy Toggler
Return
on:
setproxy("ON")
ExitApp
return
off:
setproxy("OFF")
ExitApp
return
setproxy(state="")
{
if(state = "")
state = "ON"
if (state ="ON"){
RegWrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyServer,%AddressPort%
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyEnable,1
}
else if (state="OFF"){
RegWrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyServer,
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyEnable,0
}
dllcall("wininet\InternetSetOptionW","int","0","int","39","int","0","int","0")
dllcall("wininet\InternetSetOptionW","int","0","int","37","int","0","int","0")
Return
}
;----------------------------------------------------------
; Function RegRead
;----------------------------------------------------------
RegRead(RootKey, SubKey, ValueName = "") {
RegRead, v, %RootKey%, %SubKey%, %ValueName%
Return, v
}
GuiClose:
ExitApp
@mark05e
Copy link
Author

mark05e commented May 16, 2024

Thank you for sharing @erbanku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment