Jump to content

Proxy Changer


JohnW
 Share

Recommended Posts

It is a proxy changer that emulates the tools>internet options>Connections>Lan settings dialog box.

It makes the change on the fly so you do not need to restart IE for the changes to take effect.

It is a little sloppy but is my first AutoIT program.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer
Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig,$proxyAutoTemp
Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"


ProxySetup()

While 1
Sleep(100)
WEnd

Func ProxySetup()



$proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer")

$proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable")
$proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride")
$proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page")
$proxyGetVersion = RegRead($CONSTKEYIEVER, "Version")
$proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings")
$IEVersion = StringLeft($proxyGetVersion, 1)
$autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl")
If $autoConfigUrl = -1 Then
  $autoConfigUrl = ""
EndIf

$proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2)

  Switch $proxyAutoTemp
   Case "03"
    $autoDetect = $GUI_UNCHECKED
    $autoConfig = $GUI_UNCHECKED
   Case "0B"
    $autoDetect = $GUI_CHECKED
    $autoConfig = $GUI_UNCHECKED
   Case "0F"
    $autoDetect = $GUI_CHECKED
    $autoConfig = $GUI_CHECKED
   Case "07"
    $autoDetect = $GUI_UNCHECKED
    $autoConfig = $GUI_CHECKED
   Case "01"
    $autoDetect = $GUI_UNCHECKED
    $autoConfig = $GUI_UNCHECKED
   Case "09"
    $autoDetect = $GUI_CHECKED
    $autoConfig = $GUI_UNCHECKED
   Case "0D"
    $autoDetect = $GUI_CHECKED
    $autoConfig = $GUI_CHECKED
   Case "05"
    $autoDetect = $GUI_UNCHECKED
    $autoConfig = $GUI_CHECKED
   Case Else
    $autoDetect = $GUI_UNCHECKED
    $autoConfig = $GUI_UNCHECKED
  EndSwitch


#Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf
$guiProxy = GUICreate("ProxyChange", 499, 407, 231, 168)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Events")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events")
GUISetOnEvent($GUI_EVENT_RESTORE, "_Events")
$grpAuto = GUICtrlCreateGroup("Automatic Configuration", 24, 16, 441, 105)
$chkBxAutoDetect = GUICtrlCreateCheckbox("Automatically Detect Settings", 48, 48, 201, 17)
GUICtrlSetState(-1, $autoDetect)
$chkBxAutoConfig = GUICtrlCreateCheckbox("Use Automatic configuration script", 48, 72, 209, 17)
GUICtrlSetState(-1, $autoConfig)
$inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21)
GUICtrlSetData(-1, $autoConfigUrl)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$grpProxy = GUICtrlCreateGroup("Proxy Server", 24, 128, 441, 145)
$chkBxProxyLan = GUICtrlCreateCheckbox("Use a proxy server for you LAN", 64, 160, 193, 17)
$lblProxyAddress = GUICtrlCreateLabel("Address:", 64, 184, 45, 17)
$inpProxyServer = GUICtrlCreateInput("", 144, 184, 137, 21)
$lblPort = GUICtrlCreateLabel("Port:", 288, 184, 26, 17)
$inpPort = GUICtrlCreateInput("", 336, 184, 73, 21)
$chkBxBypass = GUICtrlCreateCheckbox("Bypass proxy server for local addresses", 64, 232, 241, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$inpBypassAdd = GUICtrlCreateEdit("", 80, 280, 297, 42, $ES_MULTILINE)
$grpLocation = GUICtrlCreateGroup("Location", 112, 336, 257, 65)
$radHome = GUICtrlCreateRadio("Home", 144, 352, 105, 17)
$radGehl = GUICtrlCreateRadio("Offices", 144, 376, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$btnDefaults = GUICtrlCreateButton("Load Proxy", 24, 344, 73, 33, 0)
GUICtrlSetOnEvent(-1, "_DefaultButton")
$Button2 = GUICtrlCreateButton("Load As Shown", 400, 344, 81, 33, 0)
GUICtrlSetOnEvent(-1, "_AsShown")

If $proxyEnable = 1 Then
  $proxyPorttemp = StringSplit($proxyRegServer, ":")
  GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED)
  GUICtrlSetData($inpProxyServer, $proxyPorttemp[1])
  GUICtrlSetData($inpPort, $proxyPorttemp[2])
  GUICtrlSetState($chkBxBypass, $GUI_CHECKED)
  GUICtrlSetData($inpBypassAdd, $proxyOverride)
  GUICtrlSetState($radGehl, $GUI_CHECKED)
Else
  GUICtrlSetState($radHome, $GUI_CHECKED)
EndIf
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###







EndFunc ;==>ProxySetup

Func _Events()
Switch @GUI_CtrlId
  Case $GUI_EVENT_CLOSE
   Exit
  Case $GUI_EVENT_MINIMIZE
  Case $GUI_EVENT_RESTORE
  Case Else
EndSwitch
EndFunc ;==>_Events

Func _DefaultButton()
If $proxyAutoTemp = "03" or $proxyAutoTemp = "0B" or $proxyAutoTemp = "0F" or $proxyAutoTemp = "07" Then
  $proxyAutoTemp = "03"
Elseif $proxyAutoTemp = "01" or $proxyAutoTemp = "09" or $proxyAutoTemp = "0D" or $proxyAutoTemp = "05" Then
  $proxyAutoTemp = "01"
EndIf
Select
  Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED)
   RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000")



   DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
  Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED)
   $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
   $proxyAutoRight = StringMid($proxyAutoSettings, 21)

   $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
   RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
   RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001")
   RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
   RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

   DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
EndSelect
GUIDelete($guiProxy)
ProxySetup()
EndFunc  

Func _AsShown()

Select
  Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
   $autoConfigUrlWrite = ""
   If $proxyAutoTemp = "03" or $proxyAutoTemp = "0B" or $proxyAutoTemp = "0F" or $proxyAutoTemp = "07" Then
    $proxyAutoTemp = "03"
   Elseif $proxyAutoTemp = "01" or $proxyAutoTemp = "09" or $proxyAutoTemp = "0D" or $proxyAutoTemp = "05" Then
    $proxyAutoTemp = "01"
   EndIf
   

  Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
   $autoConfigUrlWrite = ""
   If $proxyAutoTemp = "03" or $proxyAutoTemp = "0B" or $proxyAutoTemp = "0F" or $proxyAutoTemp = "07" Then
    $proxyAutoTemp = "0B"
   Elseif $proxyAutoTemp = "01" or $proxyAutoTemp = "09" or $proxyAutoTemp = "0D" or $proxyAutoTemp = "05" Then
    $proxyAutoTemp = "09"
   EndIf
   
  Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
   $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
   If $proxyAutoTemp = "03" or $proxyAutoTemp = "0B" or $proxyAutoTemp = "0F" or $proxyAutoTemp = "07" Then
    $proxyAutoTemp = "0F"
   Elseif $proxyAutoTemp = "01" or $proxyAutoTemp = "09" or $proxyAutoTemp = "0D" or $proxyAutoTemp = "05" Then
    $proxyAutoTemp = "0D"
   EndIf
   
  Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
   $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
   If $proxyAutoTemp = "03" or $proxyAutoTemp = "0B" or $proxyAutoTemp = "0F" or $proxyAutoTemp = "07" Then
    $proxyAutoTemp = "07"
   Elseif $proxyAutoTemp = "01" or $proxyAutoTemp = "09" or $proxyAutoTemp = "0D" or $proxyAutoTemp = "05" Then
    $proxyAutoTemp = "05"
   EndIf
   
  Case Else

EndSelect

If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then
  $proxyEnableWrite = "00000001"
  $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort)
  $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>"
  $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
  $proxyAutoRight = StringMid($proxyAutoSettings, 21)

  $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
  RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
  RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
  RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer)
  RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride)
  RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then
  $proxyEnableWrite = "00000000"
  $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
  $proxyAutoRight = StringMid($proxyAutoSettings, 21)

  $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
  RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
  RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
  RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
EndIf



DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

GUIDelete($guiProxy)
ProxySetup()
EndFunc
Edited by JohnW
Link to comment
Share on other sites

If you take the code as is and load into AutoIT and run as is it will read your current settings show them in the program. I have two buttons that I needed one is for when I am at home and do not want anything in the proxy set and then the second is for when I am at the office and need the proxy set.

The only two settings that are specific to my company are under the _DefaultButton function. They are the lines

RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
   RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

I then have a button where you can manually load some settings and load them that way.

NOTE: This will only work with Internet Explorer. I think I could easily write to check what your default browser is and then load settings to either Firefox or IE.

Edited by JohnW
Link to comment
Share on other sites

My version , will be working on it more.....

#Region ; Changelog
;  1.2 Rajesh V R - GUI Modification, Added events to update Checkbox Statuses (Bypass Localserver is pending)
;~ 1.1 Rajesh V R - just tidied code 
;~ 1.0 John_W - Orignal version

#EndRegion

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer
Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig, $proxyAutoTemp
Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"

Global $AppTitle = "Proxy Changer"

ProxySetup()

While 1
    Sleep(100)
WEnd

Func ProxySetup()
    $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer")
    $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable")
    $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride")
    $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page")
    $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version")
    $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings")
    $IEVersion = StringLeft($proxyGetVersion, 1)
    $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl")

    If $autoConfigUrl = -1 Then
        $autoConfigUrl = ""
    EndIf

    $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2)

    Switch $proxyAutoTemp
        Case "03"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0B"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0F"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "07"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case "01"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "09"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0D"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "05"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case Else
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
    EndSwitch


    #Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf
    $guiProxy = GUICreate($AppTitle, 499, 507, 231, 168)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Events")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events")
    GUISetOnEvent($GUI_EVENT_RESTORE, "_Events")
    $grpAuto = GUICtrlCreateGroup("Automatic Configuration", 24, 16, 441,115)
    $chkBxAutoDetect = GUICtrlCreateCheckbox("Automatically Detect Settings", 48, 48, 201, 17)
    GUICtrlSetState(-1, $autoDetect)
    $chkBxAutoConfig = GUICtrlCreateCheckbox("Use Automatic configuration script", 48, 72, 209, 17)
    GUICtrlSetState(-1, $autoConfig)
    GUICtrlSetOnEvent(-1, "_AutoConfig_Check")
    $inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21)
    GUICtrlSetData(-1, $autoConfigUrl)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpProxy = GUICtrlCreateGroup("Proxy Server", 24, 138, 441, 185)
    $chkBxProxyLan = GUICtrlCreateCheckbox("Use a proxy server for you LAN", 64, 160, 193, 17)
    GUICtrlSetOnEvent(-1, "_ProxyLan_Check")
    $lblProxyAddress = GUICtrlCreateLabel("Address:", 64, 188, 45, 17)
    $inpProxyServer = GUICtrlCreateInput("", 124, 184, 137, 21)
    $lblPort = GUICtrlCreateLabel("Port:", 298, 188, 26, 17)
    $inpPort = GUICtrlCreateInput("", 336, 184, 73, 21)
    $chkBxBypass = GUICtrlCreateCheckbox("Bypass proxy server for local addresses", 64, 222, 241, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $inpBypassAdd = GUICtrlCreateEdit("", 80, 270, 297,42, $ES_MULTILINE)
    $grpLocation = GUICtrlCreateGroup("Location", 112, 336, 237, 45)
    $radHome = GUICtrlCreateRadio("Home", 144, 352, 105, 17)
    $radGehl = GUICtrlCreateRadio("Offices", 250, 352, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnDefaults = GUICtrlCreateButton("Retrieve System Settings", 70, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_DefaultButton")
    $Button2 = GUICtrlCreateButton("Load Above Settings", 270, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_AsShown")

    If $proxyEnable = 1 Then
        $proxyPorttemp = StringSplit($proxyRegServer, ":")
        GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED)
        GUICtrlSetData($inpProxyServer, $proxyPorttemp[1])
        GUICtrlSetData($inpPort, $proxyPorttemp[2])
        GUICtrlSetState($chkBxBypass, $GUI_CHECKED)
        GUICtrlSetData($inpBypassAdd, $proxyOverride)
        GUICtrlSetState($radGehl, $GUI_CHECKED)
    Else
        GUICtrlSetState($radHome, $GUI_CHECKED)
    EndIf
    _AutoConfig_Check() ; this will update initial state based on current values
    _ProxyLan_Check() ; this will update initial state based on current values
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

EndFunc   ;==>ProxySetup

Func _Events()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
        Case $GUI_EVENT_RESTORE
        Case Else
    EndSwitch
EndFunc   ;==>_Events

Func _DefaultButton()
    If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
        $proxyAutoTemp = "03"
    ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
        $proxyAutoTemp = "01"
    EndIf
    Select
        Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000")
            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
        Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED)
            $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
            $proxyAutoRight = StringMid($proxyAutoSettings, 21)

            $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
            RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001")
            RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
            RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
    EndSelect
    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_DefaultButton

Func _AsShown()

    Select
        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "03"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "01"
            EndIf


        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0B"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "09"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0F"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "0D"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "07"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "05"
            EndIf

        Case Else

    EndSelect

    If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then
        $proxyEnableWrite = "00000001"
        $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort)
        $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer)
        RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then
        $proxyEnableWrite = "00000000"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    EndIf

    DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_AsShown



Func _AutoConfig_Check()
    Local $IsChecked = GUICtrlRead($chkBxAutoConfig)
    
    If $IsChecked = 1 Then
        GUICtrlSetState($inpAutoConfig, $GUI_ENABLE)
    Else ; $IsChecked = 4
        GUICtrlSetState($inpAutoConfig, $GUI_DISABLE)
    EndIf
EndFunc   ;==>_AutoConfig_Checked


Func _ProxyLan_Check()
    
    $IsChecked = GUICtrlRead($chkBxProxyLan)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd, $GUI_ENABLE)
        GUICtrlSetState($inpProxyServer, $GUI_ENABLE)
        GUICtrlSetState($inpPort, $GUI_ENABLE)
        GUICtrlSetState($chkBxBypass, $GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd, $GUI_DISABLE)
        GUICtrlSetState($inpProxyServer, $GUI_DISABLE)
        GUICtrlSetState($inpPort, $GUI_DISABLE)
        GUICtrlSetState($chkBxBypass, $GUI_DISABLE)
    EndIf

EndFunc   ;==>_ProxyLan_Clicked
Link to comment
Share on other sites

sorted the exceptions as well.

This is gonna serve my initial purposes, so , i'm satisfied for the moment ^_^ thanks buddy, i just had to spend an hour to get it sorted or else, i would have spent half a day or even more on this

#Region ; Changelog
; 1.3 Rajesh V R - Sorted the Exception list as well.
;  1.2 Rajesh V R - GUI Modification, Added events to update Checkbox Statuses (Bypass Localserver is pending)
;~ 1.1 Rajesh V R - just tidied code 
;~ 1.0 John_W - Orignal version
#EndRegion

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer
Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig, $proxyAutoTemp
Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"

Global $AppTitle = "Proxy Changer"

ProxySetup()

While 1
    Sleep(100)
WEnd

Func ProxySetup()
    $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer")
    $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable")
    $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride")
    $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page")
    $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version")
    $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings")
    $IEVersion = StringLeft($proxyGetVersion, 1)
    $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl")

    If $autoConfigUrl = -1 Then
        $autoConfigUrl = ""
    EndIf

    $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2)

    Switch $proxyAutoTemp
        Case "03"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0B"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0F"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "07"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case "01"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "09"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0D"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "05"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case Else
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
    EndSwitch


    #Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf
    $guiProxy = GUICreate($AppTitle, 499, 507, 231, 168)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Events")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events")
    GUISetOnEvent($GUI_EVENT_RESTORE, "_Events")
    $grpAuto = GUICtrlCreateGroup("Automatic Configuration", 24, 16, 441,115)
    $chkBxAutoDetect = GUICtrlCreateCheckbox("Automatically Detect Settings", 48, 48, 201, 17)
    GUICtrlSetState(-1, $autoDetect)
    $chkBxAutoConfig = GUICtrlCreateCheckbox("Use Automatic configuration script", 48, 72, 209, 17)
    GUICtrlSetState(-1, $autoConfig)
    GUICtrlSetOnEvent(-1, "_AutoConfig_Check")
    $inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21)
    GUICtrlSetData(-1, $autoConfigUrl)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpProxy = GUICtrlCreateGroup("Proxy Server", 24, 138, 441, 185)
    $chkBxProxyLan = GUICtrlCreateCheckbox("Use a proxy server for you LAN", 64, 160, 193, 17)
    GUICtrlSetOnEvent(-1, "_ProxyLan_Check")
    $lblProxyAddress = GUICtrlCreateLabel("Address:", 64, 188, 45, 17)
    $inpProxyServer = GUICtrlCreateInput("", 124, 184, 137, 21)
    $lblPort = GUICtrlCreateLabel("Port:", 298, 188, 26, 17)
    $inpPort = GUICtrlCreateInput("", 336, 184, 73, 21)
    $chkBxBypass = GUICtrlCreateCheckbox("Bypass proxy server for local addresses", 64, 222, 241, 17)
    GUICtrlSetOnEvent(-1,"_chkBxBypass_Update")
    $lblBypassAdd = GUICtrlCreateLabel("Don't Use Proxy for addresses beginning with :", 64,250,282,17)
    $inpBypassAdd = GUICtrlCreateEdit("", 80, 270, 297,42, $ES_MULTILINE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpLocation = GUICtrlCreateGroup("Location", 112, 336, 237, 45)
    $radHome = GUICtrlCreateRadio("Home", 144, 352, 105, 17)
    $radGehl = GUICtrlCreateRadio("Offices", 250, 352, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnDefaults = GUICtrlCreateButton("Retrieve System Settings", 70, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_DefaultButton")
    $Button2 = GUICtrlCreateButton("Load Above Settings", 270, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_AsShown")

    If $proxyEnable = 1 Then
        $proxyPorttemp = StringSplit($proxyRegServer, ":")
        GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED)
        GUICtrlSetData($inpProxyServer, $proxyPorttemp[1])
        GUICtrlSetData($inpPort, $proxyPorttemp[2])
        GUICtrlSetState($chkBxBypass, $GUI_CHECKED)
        GUICtrlSetData($inpBypassAdd, $proxyOverride)
        GUICtrlSetState($radGehl, $GUI_CHECKED)
    Else
        GUICtrlSetState($radHome, $GUI_CHECKED)
    EndIf
    _AutoConfig_Check() ; this will update initial state based on current values
    _ProxyLan_Check() 
    
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

EndFunc   ;==>ProxySetup

Func _Events()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
        Case $GUI_EVENT_RESTORE
        Case Else
    EndSwitch
EndFunc   ;==>_Events

Func _DefaultButton()
    If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
        $proxyAutoTemp = "03"
    ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
        $proxyAutoTemp = "01"
    EndIf
    Select
        Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000")
            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
        Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED)
            $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
            $proxyAutoRight = StringMid($proxyAutoSettings, 21)

            $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
            RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001")
            RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
            RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
    EndSelect
    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_DefaultButton

Func _AsShown()

    Select
        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "03"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "01"
            EndIf


        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0B"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "09"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0F"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "0D"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "07"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "05"
            EndIf

        Case Else

    EndSelect

    If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then
        $proxyEnableWrite = "00000001"
        $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort)
        $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer)
        RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then
        $proxyEnableWrite = "00000000"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    EndIf

    DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_AsShown



Func _AutoConfig_Check()
    Local $IsChecked = GUICtrlRead($chkBxAutoConfig)
    
    If $IsChecked = 1 Then
        GUICtrlSetState($inpAutoConfig, $GUI_ENABLE)
    Else ; $IsChecked = 4
        GUICtrlSetState($inpAutoConfig, $GUI_DISABLE)
    EndIf
EndFunc   ;==>_AutoConfig_Checked


Func _ProxyLan_Check()
    
    $IsChecked = GUICtrlRead($chkBxProxyLan)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd, $GUI_ENABLE)
        GUICtrlSetState($inpProxyServer, $GUI_ENABLE)
        GUICtrlSetState($inpPort, $GUI_ENABLE)
        GUICtrlSetState($chkBxBypass, $GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd, $GUI_DISABLE)
        GUICtrlSetState($inpProxyServer, $GUI_DISABLE)
        GUICtrlSetState($inpPort, $GUI_DISABLE)
        GUICtrlSetState($chkBxBypass, $GUI_DISABLE)
    EndIf
    _chkBxBypass_Update()

EndFunc   ;==>_ProxyLan_Clicked

Func _chkBxBypass_Update()
    $IsChecked = GUICtrlRead($chkBxBypass)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd,$GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd,$GUI_DISABLE)
    EndIf
EndFunc
Link to comment
Share on other sites

Glad someone found it useful. As I said it is my first real AutoIT script so it is pretty sloppy but did what I needed it to do.

Just a little information for you. The bypass local server is as far as I can tell is dependent on <local> being inside of the exceptions.

Link to comment
Share on other sites

opppsy, sorry i did think i missed something. hehehe my bad. will get it sorted.. <just checked i had wrote it down yesterday to put a check box lol:> but i gotta understand more on interdependency of bypasslocal & exceptions

Edited by rajeshontheweb
Link to comment
Share on other sites

; 23 Apr 1.4 Rajesh V R - Exceptions now is seperate - not associated with local addresses.

#Region ; Changelog
; 1.4 Rajesh V R - Exceptions now is seperate - not associated with local addresses.
; 1.3 Rajesh V R - Sorted the Exception list as well.
; 1.2 Rajesh V R - GUI Modification, Added events to update Checkbox Statuses (Bypass Localserver is pending)
; 1.1 Rajesh V R - just tidied code 
; 1.0 John_W - Orignal version

#EndRegion

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer , $chkBxExceptions
Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig, $proxyAutoTemp
Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"

Global $AppTitle = "Proxy Changer"

ProxySetup()

While 1
    Sleep(100)
WEnd

Func ProxySetup()
    $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer")
    $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable")
    $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride")
    $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page")
    $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version")
    $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings")
    $IEVersion = StringLeft($proxyGetVersion, 1)
    $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl")

    If $autoConfigUrl = -1 Then
        $autoConfigUrl = ""
    EndIf

    $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2)

    Switch $proxyAutoTemp
        Case "03"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0B"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0F"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "07"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case "01"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "09"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0D"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "05"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case Else
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
    EndSwitch


    #Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf
    $guiProxy = GUICreate($AppTitle, 499, 507, 231, 168)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Events")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events")
    GUISetOnEvent($GUI_EVENT_RESTORE, "_Events")
    $grpAuto = GUICtrlCreateGroup("Automatic Configuration", 24, 16, 441,115)
    $chkBxAutoDetect = GUICtrlCreateCheckbox("Automatically Detect Settings", 48, 48, 201, 17)
    GUICtrlSetState(-1, $autoDetect)
    $chkBxAutoConfig = GUICtrlCreateCheckbox("Use Automatic configuration script", 48, 72, 209, 17)
    GUICtrlSetState(-1, $autoConfig)
    GUICtrlSetOnEvent(-1, "_AutoConfig_Check")
    $inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21)
    GUICtrlSetData(-1, $autoConfigUrl)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpProxy = GUICtrlCreateGroup("Proxy Server", 24, 138, 441,195)
    $chkBxProxyLan = GUICtrlCreateCheckbox("Use a proxy server for you LAN", 64, 160, 193, 17)
    GUICtrlSetOnEvent(-1, "_ProxyLan_Check")
    
    $lblProxyAddress = GUICtrlCreateLabel("Address:",94, 188, 45, 17)
    $inpProxyServer = GUICtrlCreateInput("", 144, 184, 137, 21)
    $lblPort = GUICtrlCreateLabel("Port:", 308, 188, 26, 17)
    $inpPort = GUICtrlCreateInput("", 336, 184, 73, 21)
        
    $chkBxBypass = GUICtrlCreateCheckbox("Bypass proxy server for local addresses", 64, 222, 221, 17)
    
    $chkBxExceptions = GUICtrlCreateCheckbox("Allow Exceptions", 300, 222, 241, 17)
    GUICtrlSetOnEvent(-1,"_chkBxExceptions_Update")
    
    
    $lblBypassAdd = GUICtrlCreateLabel("Don't Use Proxy for addresses beginning with :", 80,250,282,17)
    $inpBypassAdd = GUICtrlCreateEdit("", 80, 270, 297,42, $ES_MULTILINE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpLocation = GUICtrlCreateGroup("Location", 112, 336, 237, 45)
    $radHome = GUICtrlCreateRadio("Home", 144, 352, 105, 17)
    $radGehl = GUICtrlCreateRadio("Offices", 250, 352, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnDefaults = GUICtrlCreateButton("Retrieve System Settings", 70, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_DefaultButton")
    $Button2 = GUICtrlCreateButton("Load Above Settings", 270, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_AsShown")

    If $proxyEnable = 1 Then
        $proxyPorttemp = StringSplit($proxyRegServer, ":")
        GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED)
        GUICtrlSetData($inpProxyServer, $proxyPorttemp[1])
        GUICtrlSetData($inpPort, $proxyPorttemp[2])
        GUICtrlSetState($chkBxBypass, $GUI_CHECKED)
        GUICtrlSetData($inpBypassAdd, $proxyOverride)
        GUICtrlSetState($radGehl, $GUI_CHECKED)
    Else
        GUICtrlSetState($radHome, $GUI_CHECKED)
    EndIf
    _AutoConfig_Check() ; this will update initial state based on current values
    _ProxyLan_Check() 
    
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

EndFunc   ;==>ProxySetup

Func _Events()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
        Case $GUI_EVENT_RESTORE
        Case Else
    EndSwitch
EndFunc   ;==>_Events

Func _DefaultButton()
    If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
        $proxyAutoTemp = "03"
    ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
        $proxyAutoTemp = "01"
    EndIf
    Select
        Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000")
            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
        Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED)
            $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
            $proxyAutoRight = StringMid($proxyAutoSettings, 21)

            $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
            RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001")
            RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
            RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
    EndSelect
    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_DefaultButton

Func _AsShown()

    Select
        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "03"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "01"
            EndIf


        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0B"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "09"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0F"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "0D"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "07"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "05"
            EndIf

        Case Else

    EndSelect

    If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then
        $proxyEnableWrite = "00000001"
        $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort)
        $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer)
        RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then
        $proxyEnableWrite = "00000000"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    EndIf

    DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_AsShown



Func _AutoConfig_Check()
    Local $IsChecked = GUICtrlRead($chkBxAutoConfig)
    
    If $IsChecked = 1 Then
        GUICtrlSetState($inpAutoConfig, $GUI_ENABLE)
    Else ; $IsChecked = 4
        GUICtrlSetState($inpAutoConfig, $GUI_DISABLE)
    EndIf
EndFunc   ;==>_AutoConfig_Checked


Func _ProxyLan_Check()
    
    $IsChecked = GUICtrlRead($chkBxProxyLan)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd, $GUI_ENABLE)
        GUICtrlSetState($inpProxyServer, $GUI_ENABLE)
        GUICtrlSetState($inpPort, $GUI_ENABLE)
        GUICtrlSetState($chkBxBypass, $GUI_ENABLE)
        GUICtrlSetState($chkBxExceptions, $GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd, $GUI_DISABLE)
        GUICtrlSetState($inpProxyServer, $GUI_DISABLE)
        GUICtrlSetState($inpPort, $GUI_DISABLE)
        GUICtrlSetState($chkBxBypass, $GUI_DISABLE)
        GUICtrlSetState($chkBxExceptions, $GUI_DISABLE)
    EndIf
    _chkBxExceptions_Update()

EndFunc   ;==>_ProxyLan_Clicked

Func _chkBxExceptions_Update()
    $IsChecked = GUICtrlRead($chkBxExceptions)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd,$GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd,$GUI_DISABLE)
    EndIf
EndFunc
Link to comment
Share on other sites

  • 3 weeks later...

@JohnW

First off sweet your first script is looking great...

And now some tips.

1.If you are using scite then i suggest the SciTE4AutoIt3 package(linky ftw!)

2.If you use SciTE and you have this above package you should use Tidy(Ctrl+T i believe)

Also look through the tools the package has in it a lot of them have been useful to me over the years ^_^

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

Link to comment
Share on other sites

Thanks for the replys.

As I said previously I am pretty new to AutoIT and this is my first real application.

If anybody does do improvements to the program I would appreciate if you could post them to help me learn.

Thanks

Link to comment
Share on other sites

  • 4 months later...

My version , will be working on it more.....

#Region ; Changelog
;  1.2 Rajesh V R - GUI Modification, Added events to update Checkbox Statuses (Bypass Localserver is pending)
;~ 1.1 Rajesh V R - just tidied code 
;~ 1.0 John_W - Orignal version

#EndRegion

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer
Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig, $proxyAutoTemp
Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main"
Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"

Global $AppTitle = "Proxy Changer"

ProxySetup()

While 1
    Sleep(100)
WEnd

Func ProxySetup()
    $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer")
    $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable")
    $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride")
    $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page")
    $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version")
    $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings")
    $IEVersion = StringLeft($proxyGetVersion, 1)
    $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl")

    If $autoConfigUrl = -1 Then
        $autoConfigUrl = ""
    EndIf

    $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2)

    Switch $proxyAutoTemp
        Case "03"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0B"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0F"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "07"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case "01"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "09"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_UNCHECKED
        Case "0D"
            $autoDetect = $GUI_CHECKED
            $autoConfig = $GUI_CHECKED
        Case "05"
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_CHECKED
        Case Else
            $autoDetect = $GUI_UNCHECKED
            $autoConfig = $GUI_UNCHECKED
    EndSwitch


    #Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf
    $guiProxy = GUICreate($AppTitle, 499, 507, 231, 168)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Events")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events")
    GUISetOnEvent($GUI_EVENT_RESTORE, "_Events")
    $grpAuto = GUICtrlCreateGroup("Automatic Configuration", 24, 16, 441,115)
    $chkBxAutoDetect = GUICtrlCreateCheckbox("Automatically Detect Settings", 48, 48, 201, 17)
    GUICtrlSetState(-1, $autoDetect)
    $chkBxAutoConfig = GUICtrlCreateCheckbox("Use Automatic configuration script", 48, 72, 209, 17)
    GUICtrlSetState(-1, $autoConfig)
    GUICtrlSetOnEvent(-1, "_AutoConfig_Check")
    $inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21)
    GUICtrlSetData(-1, $autoConfigUrl)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $grpProxy = GUICtrlCreateGroup("Proxy Server", 24, 138, 441, 185)
    $chkBxProxyLan = GUICtrlCreateCheckbox("Use a proxy server for you LAN", 64, 160, 193, 17)
    GUICtrlSetOnEvent(-1, "_ProxyLan_Check")
    $lblProxyAddress = GUICtrlCreateLabel("Address:", 64, 188, 45, 17)
    $inpProxyServer = GUICtrlCreateInput("", 124, 184, 137, 21)
    $lblPort = GUICtrlCreateLabel("Port:", 298, 188, 26, 17)
    $inpPort = GUICtrlCreateInput("", 336, 184, 73, 21)
    $chkBxBypass = GUICtrlCreateCheckbox("Bypass proxy server for local addresses", 64, 222, 241, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $inpBypassAdd = GUICtrlCreateEdit("", 80, 270, 297,42, $ES_MULTILINE)
    $grpLocation = GUICtrlCreateGroup("Location", 112, 336, 237, 45)
    $radHome = GUICtrlCreateRadio("Home", 144, 352, 105, 17)
    $radGehl = GUICtrlCreateRadio("Offices", 250, 352, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btnDefaults = GUICtrlCreateButton("Retrieve System Settings", 70, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_DefaultButton")
    $Button2 = GUICtrlCreateButton("Load Above Settings", 270, 424, 150, 33, 0)
    GUICtrlSetOnEvent(-1, "_AsShown")

    If $proxyEnable = 1 Then
        $proxyPorttemp = StringSplit($proxyRegServer, ":")
        GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED)
        GUICtrlSetData($inpProxyServer, $proxyPorttemp[1])
        GUICtrlSetData($inpPort, $proxyPorttemp[2])
        GUICtrlSetState($chkBxBypass, $GUI_CHECKED)
        GUICtrlSetData($inpBypassAdd, $proxyOverride)
        GUICtrlSetState($radGehl, $GUI_CHECKED)
    Else
        GUICtrlSetState($radHome, $GUI_CHECKED)
    EndIf
    _AutoConfig_Check() ; this will update initial state based on current values
    _ProxyLan_Check() ; this will update initial state based on current values
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

EndFunc   ;==>ProxySetup

Func _Events()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
        Case $GUI_EVENT_RESTORE
        Case Else
    EndSwitch
EndFunc   ;==>_Events

Func _DefaultButton()
    If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
        $proxyAutoTemp = "03"
    ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
        $proxyAutoTemp = "01"
    EndIf
    Select
        Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000")
            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
        Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED)
            $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
            $proxyAutoRight = StringMid($proxyAutoSettings, 21)

            $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
            RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
            RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001")
            RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80")
            RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>")

            DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)
    EndSelect
    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_DefaultButton

Func _AsShown()

    Select
        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "03"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "01"
            EndIf


        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED
            $autoConfigUrlWrite = ""
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0B"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "09"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "0F"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "0D"
            EndIf

        Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED
            $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig)
            If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then
                $proxyAutoTemp = "07"
            ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then
                $proxyAutoTemp = "05"
            EndIf

        Case Else

    EndSelect

    If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then
        $proxyEnableWrite = "00000001"
        $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort)
        $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer)
        RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then
        $proxyEnableWrite = "00000000"
        $proxyAutoLeft = StringLeft($proxyAutoSettings, 18)
        $proxyAutoRight = StringMid($proxyAutoSettings, 21)

        $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight
        RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite)
        RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite)
        RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite)
    EndIf

    DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

    GUIDelete($guiProxy)
    ProxySetup()
EndFunc   ;==>_AsShown



Func _AutoConfig_Check()
    Local $IsChecked = GUICtrlRead($chkBxAutoConfig)
    
    If $IsChecked = 1 Then
        GUICtrlSetState($inpAutoConfig, $GUI_ENABLE)
    Else ; $IsChecked = 4
        GUICtrlSetState($inpAutoConfig, $GUI_DISABLE)
    EndIf
EndFunc   ;==>_AutoConfig_Checked


Func _ProxyLan_Check()
    
    $IsChecked = GUICtrlRead($chkBxProxyLan)
    If $IsChecked = 1 Then
        GUICtrlSetState($inpBypassAdd, $GUI_ENABLE)
        GUICtrlSetState($inpProxyServer, $GUI_ENABLE)
        GUICtrlSetState($inpPort, $GUI_ENABLE)
        GUICtrlSetState($chkBxBypass, $GUI_ENABLE)
    Else
        GUICtrlSetState($inpBypassAdd, $GUI_DISABLE)
        GUICtrlSetState($inpProxyServer, $GUI_DISABLE)
        GUICtrlSetState($inpPort, $GUI_DISABLE)
        GUICtrlSetState($chkBxBypass, $GUI_DISABLE)
    EndIf

EndFunc   ;==>_ProxyLan_Clicked

RLY nicely done dude! /salute@you...

Is There A Life BEFORE Death?im stupidSaved warn logs: cheateraSmOke_N Note Added 17 January 2009 - 02:54 PM Added to warn level Posting a way to hack the registry and force sending someones desktop via TCP. Jos Note Added 25 November 2008 - 02:52 PM Added to warn level for being an impolite rookie.once a year i go bad ... what will happen in 2010??[u]Its GOOD to be BAD ... (Warlock's Succubus - World of Warcraft)[/u]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...