diff --git a/toggle_proxy.ahk b/toggle_proxy.ahk new file mode 100644 index 0000000..f27dd50 --- /dev/null +++ b/toggle_proxy.ahk @@ -0,0 +1,63 @@ +#Persistent +#SingleInstance + +RegKey := "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" +ProxyEnabled = False +MenuItem := "Enable Proxy (Win+Ctrl+Shift+P)" + +Menu, Tray, NoMainWindow +Menu, Tray, NoStandard + +Menu, Tray, Add, %MenuItem%, ToggleProxy +Menu, Tray, Add, Proxy Settings, ProxySetting +Menu, Tray, Add +Menu, Tray, Add, Exit, ExitApp + +Menu, Tray, Default, %MenuItem% + +UpdateProxyState() +return + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +#^+p:: +Goto, ToggleProxy +return + +UpdateProxyState(){ + global RegKey, ProxyEnabled, MenuItem + RegRead, ProxyEnabled, %RegKey%, ProxyEnable + if (ProxyEnabled) + { + Menu, Tray, Tip, Proxy On + Menu, Tray, Icon, imageres.dll, 226 + Menu, Tray, Check, %MenuItem% + } + Else + { + Menu, Tray, Tip, Proxy Off + Menu, Tray, Icon, imageres.dll, 260 + Menu, Tray, UnCheck, %MenuItem% + } +} + +ToggleProxy: +UpdateProxyState() +If (ProxyEnabled) +{ + RegWrite, REG_DWORD, %RegKey%, ProxyEnable, 0 +} +Else +{ + RegWrite, REG_DWORD, %RegKey%, ProxyEnable, 1 +} +UpdateProxyState() +return + +ProxySetting: +RunWait, ms-settings:network-proxy +return + +ExitApp: + ExitApp +return \ No newline at end of file