Jump to content

please lend a hand


Recommended Posts

ok first things first i feel like a complete idiot for asking this because im made scripts before and this ones just doesn't work some please take a look at it and tell me what i am doing wrong its late and its bugging me..... many thankz

#include <GuiConstants.au3>

$proxystatus = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings","ProxyEnable")

GUICreate ("Geek Squad Tools",140,@desktopheight-30,@desktopwidth-140,0,0x10000000,0x00000080)

$Proxy = GuiCtrlCreateLabel("STupid",10,10,55,16, 0x1000)

$proxybutton = GuiCtrlCreateButton("Switch",70,8,60,20)

If $proxystatus = 1 Then

GuiCtrlSetData($proxy, "Proxy ON")

Else

GuiCtrlSetData($proxy, "Proxy OFF")

Endif

While 1

$msg = GUIGetMsg()

Select

Case $msg = $proxybutton

MsgBox(0, "AutoIt Example", "button pressed")

If $proxystatus = 0 Then

MsgBox(0, "AutoIt Example", "adding proxy")

;--------------Add Proxy----------------

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","<local>")

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","168.94.74.68:8080")

$proxystatus = 1

GuiCtrlSetData($proxy, "Proxy ON")

MsgBox(0, "AutoIt Example", "Proxy added")

Else

MsgBox(0, "AutoIt Example", "Removing proxy")

;--------------Remove Proxy-------------

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable","REG_DWORD","0")

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyOverride","REG_SZ","")

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","")

$proxystatus = 0

GuiCtrlSetData($proxy, "Proxy OFF")

MsgBox(0, "AutoIt Example", "Proxy removed")

Endif

Endselect

wend

Link to comment
Share on other sites

try adding the GuiSetState()

#include <GuiConstants.au3>
$proxystatus = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings", "ProxyEnable")


GUICreate("Geek Squad Tools", 140, @DesktopHeight - 30, @DesktopWidth - 140, 0, 0x10000000, 0x00000080)
$Proxy = GUICtrlCreateLabel("STupid", 10, 10, 55, 16, 0x1000)
$proxybutton = GUICtrlCreateButton("Switch", 70, 8, 60, 20)
If $proxystatus = 1 Then
 GUICtrlSetData($Proxy, "Proxy ON")
Else
 GUICtrlSetData($Proxy, "Proxy OFF")
EndIf

GUISetState()

While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $proxybutton
   MsgBox(0, "AutoIt Example", "button pressed")
   If $proxystatus = 0 Then
    MsgBox(0, "AutoIt Example", "adding proxy")
   ;--------------Add Proxy----------------
    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", "<local>")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "168.94.74.68:8080")
    $proxystatus = 1
    GUICtrlSetData($Proxy, "Proxy ON")
    MsgBox(0, "AutoIt Example", "Proxy added")
   Else
    MsgBox(0, "AutoIt Example", "Removing proxy")
   ;--------------Remove Proxy-------------
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "0")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "")
    $proxystatus = 0
    GUICtrlSetData($Proxy, "Proxy OFF")
    MsgBox(0, "AutoIt Example", "Proxy removed")
   EndIf
 EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...