jagreygoose

Proxy Snippet

Jun 12th, 2014
3,711
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.27 KB | None | 0 0
  1. #include <MsgBoxConstants.au3>
  2.  
  3. local $PAC = "http://10.0.84.24/proxy.pac"
  4. local $regKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
  5. local $regError = ""
  6. local $errorTitle = ""
  7. Local $msgTimeout = 3
  8.  
  9. If @OSArch <> "X86" Then $regKey = "HKEY_CURRENT_USER64\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
  10.  
  11. RegWrite($regKey, "ProxyServer", "REG_SZ", "")
  12. RegWrite($regKey, "ProxyEnable","REG_DWORD", "0")
  13. RegWrite($regKey, "AutoConfigURL", "REG_SZ", $PAC)
  14.  
  15. Switch @error
  16.     Case 1
  17.         $regError =  "Unable to open requested key"
  18.         $errorTitle = "Error"
  19.  
  20.     Case 2
  21.         $regError = "Unable to open requested main key"
  22.         $errorTitle = "Error"
  23.     Case 3
  24.         $regError = "Unable to remote connect to the registry"
  25.         $errorTitle = "Error"
  26.     Case -1
  27.         $regError = "Unable to open requested value"
  28.         $errorTitle = "Error"
  29.     Case -2
  30.         $regError = "Value type not supported"
  31.         $errorTitle = "Error"
  32.     Case 0
  33.         $regError = "Fixed! Enter a new URL into the browser"
  34.         $errorTitle = "Success"
  35.     Case Else
  36.         $regError = "Unexpected Error"
  37.         $errorTitle = "Error"
  38. EndSwitch
  39.  
  40. DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
  41.  
  42. MsgBox($MB_SYSTEMMODAL, $errorTitle, $regError, $msgTimeout)
Advertisement