Created
August 29, 2019 07:05
-
-
Save mark05e/955d06a92a2e9e9dcd40b7efd03063f0 to your computer and use it in GitHub Desktop.
AHK Script to enable/disable proxy. Works on Win10 too!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; set_ie_proxy.ahk | |
;################################################################################# | |
; Enable/Disable IE Proxy | |
;################################################################################# | |
; ref: https://autohotkey.com/board/topic/101854-switch-proxy-on-or-off/?p=633874 | |
SetProxy("proxy.myproxyprovider.com:1234",1) | |
,HostProxy=RegRead(,,"ProxyServer") | |
,ProxyStatus=RegRead(,,"ProxyEnable") | |
If ProxyStatus | |
ProxyStatus:="ON" | |
else ProxyStatus:="OFF" | |
Msgbox,Your proxy IP address is: %HostProxy%`nThis proxy is %ProxyStatus% | |
SetProxy(AddressPort:="",State:=""){ | |
IfNotEqual,AddressPort,,RegWrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyServer,%AddressPort% | |
RegWrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyEnable,% ((State=""||State=1)?1:0) | |
DllCall("wininet\InternetSetOptionW",int,0,int,39,int,0,int,0),DllCall("wininet\InternetSetOptionW",int,0,int,37,int,0,int,0) | |
return | |
} | |
RegRead(RootKey:="HKCU",SubKey:="Software\Microsoft\Windows\CurrentVersion\Internet Settings",ValueName:=""){ | |
RegRead,O,%RootKey%,%SubKey%,%ValueName% | |
return O | |
} | |
;################################################################################# | |
;EXAMPLES | |
;################################################################################# | |
;SetProxy("0.0.0.0:0",0) ; set 0.0.0.0, port 0 as proxy address and disable proxy usage | |
;SetProxy("0.0.0.0:0",1) ; set 0.0.0.0, port 0 as proxy address and ENABLE proxy usage | |
;SetProxy("",0) ; clear proxy address and disable proxy usage | |
; Shortcut to access IE proxy settings | |
; on the run prompt type: control inetcpl.cpl,,4 | |
; ref: http://www.renjusblog.com/2013/09/create-shortcut-key-lan-settings-window.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works fine.
(Written by ChatGPT)