JohnW Posted April 15, 2009 Share Posted April 15, 2009 (edited) 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. expandcollapse popup#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 April 15, 2009 by JohnW Link to comment Share on other sites More sharing options...
vampirevn01 Posted April 21, 2009 Share Posted April 21, 2009 I don't know how to use that. Can you help me. I want a small program can change proxy setting (using socks4 or socks5) Thanks for help Link to comment Share on other sites More sharing options...
JohnW Posted April 21, 2009 Author Share Posted April 21, 2009 (edited) 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 April 21, 2009 by JohnW Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 22, 2009 Share Posted April 22, 2009 hey buddy, u saved me a lot of time on my projects in queue..... thanks a lot. i'm working on few basic mods to this app. i would have gone for a little different GUI but i can use this as well. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 22, 2009 Share Posted April 22, 2009 My version , will be working on it more..... expandcollapse popup#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 Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 22, 2009 Share Posted April 22, 2009 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 expandcollapse popup#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 Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
JohnW Posted April 22, 2009 Author Share Posted April 22, 2009 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 More sharing options...
rajeshontheweb Posted April 23, 2009 Share Posted April 23, 2009 (edited) 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 April 23, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 23, 2009 Share Posted April 23, 2009 ; 23 Apr 1.4 Rajesh V R - Exceptions now is seperate - not associated with local addresses. expandcollapse popup#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 Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
ThuongTin Posted May 8, 2009 Share Posted May 8, 2009 I want to use socks. Can you help me? Link to comment Share on other sites More sharing options...
MerkurAlex Posted May 8, 2009 Share Posted May 8, 2009 @JohnWFirst 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 More sharing options...
rajeshontheweb Posted May 9, 2009 Share Posted May 9, 2009 @Thoungtin, will try to update it tomorrow. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
ThuongTin Posted May 10, 2009 Share Posted May 10, 2009 (edited) My name is Thuong Tin not Thougntin. I'm Vietnames. I'm study bad English I want to Set proxy, set socks4, socks5 for FF. Can you help me? Edited May 17, 2009 by ThuongTin Link to comment Share on other sites More sharing options...
BrettF Posted May 10, 2009 Share Posted May 10, 2009 Check out the FF UDF. It may be in there. FYI he used your forum display name... Cheers Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
elho Posted May 15, 2009 Share Posted May 15, 2009 Hi, thanks for this big script. I want to call your script within another AutoIt script. it is not a function to call? example changeproxy (newip: port). Link to comment Share on other sites More sharing options...
elho Posted May 15, 2009 Share Posted May 15, 2009 I mean that: Batch function for enabling/disabling - changing proxy without GUI. Link to comment Share on other sites More sharing options...
elho Posted May 15, 2009 Share Posted May 15, 2009 I mean that: Batch function for enabling/disabling - changing proxy without GUI.Thanks i dit it. Link to comment Share on other sites More sharing options...
lsakizada Posted May 16, 2009 Share Posted May 16, 2009 Thanks i dit it.Can you please post it. I need to disable it automaticly on my computer at work. Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
JohnW Posted May 19, 2009 Author Share Posted May 19, 2009 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 More sharing options...
cheatera Posted October 15, 2009 Share Posted October 15, 2009 My version , will be working on it more..... expandcollapse popup#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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now