Sign in to follow this  
Followers 0
imbrija

Simple Proxy Switcher (through registry)

1 post in this topic

Not sure if this is the right place to post this....I wrote a simple script to enable-disable proxy through registry.

Here it is:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Global $btPokreni, $msg, $glKljuc, $regPathChk, $regChkTitle, $btnNaziv, $lblGUI
;registry key to check
$glKljuc = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
ProvjeriReg()
GUICreate ("Proxy Switcher",300, 150)
$lblGUI = GUICtrlCreateLabel($regChkTitle, 25, 20, 280, 40)
$btPokreni = GUICtrlCreateButton($btnNaziv, 120, 80, 60)
GUISetState(@SW_SHOW)
While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $btPokreni
    If $regPathChk = 1 Then
     ;To disable proxy:
     RegWrite ($glKljuc, "ProxyEnable", "REG_DWORD", "00000000")
     MsgBox("","Off","Proxy is off!", 2)
     ProvjeriReg()
     PromjeniGUI()
    Else
     ;To enable proxy:
     RegWrite ($glKljuc, "ProxyEnable", "REG_DWORD", "00000001")
     MsgBox("","On","Proxy is on!", 2)
     ProvjeriReg()
     PromjeniGUI()
    EndIf
  EndSelect
WEnd
;Funkcije
Func ProvjeriReg()
$regPathChk = RegRead ($glKljuc, "ProxyEnable")
If $regPathChk = 0 Then
     ;To disable proxy:
     $regChkTitle = "At the moment Proxy is OFF!"
     $btnNaziv = "On!"
    Else
     ;To enable proxy:
     $regChkTitle = "At the moment Proxy is ON!"
     $btnNaziv = "Off!"
    EndIf
EndFunc
Func PromjeniGUI()
GUICtrlSetData($btPokreni, $btnNaziv)
GUICtrlSetData($lblGUI, $regChkTitle)
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0