Skip to content

Instantly share code, notes, and snippets.

@xiaoli
Last active February 9, 2018 12:30
Show Gist options
  • Save xiaoli/82f7ad298352bb171a37b83dce086b70 to your computer and use it in GitHub Desktop.
Save xiaoli/82f7ad298352bb171a37b83dce086b70 to your computer and use it in GitHub Desktop.
Http Proxy Enable/Disable Script
Gui, Add, Button, x46 y20 w100 h30 Gon , Proxy ON
Gui, Add, Button, x46 y60 w100 h30 Goff , Proxy OFF
Gui, Add, Button, x46 y100 w100 h30 Ggtfo , Exit
; Generated using SmartGUI Creator 4.0
Gui, Show, x129 y99 h146 w194, Proxy Status
Return
on:
setproxy("ON", "127.0.0.1:1080")
return
off:
setproxy("OFF")
return
setproxy(state="", address="")
{
if(state = "")
state = "ON"
if (state ="ON")
{
regwrite,REG_SZ,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,ProxyServer,%address%
regwrite,REG_DWORD,HKCU,Software\Microsoft\Windows\CurrentVersion\Internet Settings,Proxyenable,1
}
else if (state="OFF")
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
}
gtfo:
ExitApp
GuiClose:
ExitApp
@xiaoli
Copy link
Author

xiaoli commented Feb 9, 2018

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