1) I want to add the button for load proxy list
2) I want to add the button for changer ip address
my autoit
PHP Code:
#include <GUIConstantsEx.au3>
#include <GUIListViewEx.au3>
HotKeySet("{ESC}", "_Terminate")
$GUI = GUICreate("[Proxy Switcher]", 235, 369, 493, 134)
$btnOk = GUICtrlCreateButton("&ON / OFF", 88, 336, 65, 25)
$lstServer = GUICtrlCreateList("", 8, 64, 217, 97)
$btnExit = GUICtrlCreateButton("&Exit", 160, 336, 65, 25, 0)
$Group = GUICtrlCreateGroup("Settings", 8, 280, 217, 49)
$optEnabled = GUICtrlCreateRadio("Enabled", 24, 304, 73, 17)
$optDisabled = GUICtrlCreateRadio("Disabled", 144, 304, 73, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$grpProxy = GUICtrlCreateGroup("Proxy Server", 8, 8, 217, 49)
$lblProxy = GUICtrlCreateLabel("lblProxy", 24, 32, 192, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$edtExceptions = GUICtrlCreateEdit("", 8, 200, 217, 73)
GUICtrlSetData(-1, "")
$Label = GUICtrlCreateLabel("Exceptions:", 8, 180, 59, 17)
GUISetBkColor(0x808080)
GUISetState(@SW_SHOW)
If Not FileExists(@ScriptDir & "\Proxy.ini") Then
MsgBox(48, "File Not Found", "Required file not found (" & @ScriptDir & "\Proxy.ini" & ")" & @CRLF & "" & @CRLF & "Proxy Switcher Will Exit!!!")
Exit
EndIf
; Get IE Proxy server Registry values
$sProxy = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")
$iEnabled = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable")
$sExceptions = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride")
If $iEnabled Then
GUICtrlSetState($optEnabled, $GUI_CHECKED)
TrayTip("Proxy Server: ", $sProxy, 5, 1)
TraySetToolTip("Proxy Server: " & $sProxy)
GUICtrlSetData($lblProxy, $sProxy)
Else
GUICtrlSetState($optDisabled, $GUI_CHECKED)
TrayTip("Proxy Server: ", "Disabled(Direct Connection)", 5, 1)
TraySetToolTip("Proxy Server: Disabled(Direct Connection)")
GUICtrlSetData($lblProxy, $sExceptions)
EndIf
GUICtrlSetData($edtExceptions, $sExceptions)
;Proxy servers configuration
$sSection = IniReadSection(@ScriptDir & "\Proxy.ini", "config")
If @error Then
MsgBox(16, "Proxy Switcher", "Unable to read the section Server")
Exit
Else
;Load ListBox
Local $iLstIndex = 0
For $iSection = 1 To $sSection[0][0]
GUICtrlSetData($lstServer, $sSection[$iSection][0] & " ===> " & $sSection[$iSection][1])
If $sProxy = $sSection[$iSection][1] Then
GUICtrlSetData($grpProxy, "Proxy: " & $sSection[$iSection][0])
$iLstIndex = $iSection - 1
EndIf
Next
If $iLstIndex > 0 Then
$ret = GUICtrlSetData($lstServer, $iLstIndex)
EndIf
EndIf
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btnExit
_Terminate()
Case $msg = $btnOk
_Start()
EndSelect
WEnd
Func _Start()
;Proxy enabled
If GUICtrlRead($optEnabled) = $GUI_CHECKED Then
$sTmpKey = GUICtrlRead($lstServer)
$sKey = StringLeft($sTmpKey, StringInStr($sTmpKey, " ===> "))
If $sKey = "" Then
MsgBox(48, "Error Message", "No proxy selected")
Else
$sProxy = IniRead(@ScriptDir & "\Proxy.ini", "config", $sKey, "NotFound")
If @error Or $sProxy = "NotFound" Then
MsgBox(16, "Proxy Switcher", "Unable to read the Key " & $sKey)
Exit
Else
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $sProxy)
TrayTip("Proxy Server: ", $sProxy, 5, 1)
TraySetToolTip("Proxy Server: " & $sProxy)
GUICtrlSetData($lblProxy, $sProxy)
GUICtrlSetData($grpProxy, "Proxy: " & $sKey)
EndIf
EndIf
$sExceptions = GUICtrlRead($edtExceptions)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", $sExceptions)
Else
;Proxy Disabled
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 0)
TrayTip("Proxy Server: ", "Disabled (Direct Connection)", 5, 1)
TraySetToolTip("Proxy Server: Disabled(Direct Connection)")
GUICtrlSetData($lblProxy, "Disabled (Direct Connection)")
GUICtrlSetData($grpProxy, "Proxy")
EndIf
EndFunc
Func _Terminate()
Exit 0
EndFunc