Jump to content

Here's my first scipt


roboman
 Share

Recommended Posts

I got tired of having to go in to IE settings to turn off my Proxy server when I'm out of the office, so here's the script I created to do it.

; This script toggles Proxy setting for IE

#include <GUIConstants.au3>

Opt("GUIOnEventMode",1)

GUICreate("Proxy Control", 210, 80)

$Label = GUICtrlCreateLabel("Click a button to change Proxy settings", 10, 10)

$YesID = GUICtrlCreateButton("Proxy On", 10, 50, 50, 20)

GUICtrlSetOnEvent($YesID,"OnYes")

$NoID = GUICtrlCreateButton("Proxy Off", 80, 50, 50, 20)

GUICtrlSetOnEvent($NoID,"OnNo")

$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)

GUICtrlSetOnEvent($ExitID,"OnExit")

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GUISetState() ; display the GUI

While 1

Sleep (1000)

WEnd

;--------------- Functions ---------------

Func OnYes()

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

EndFunc

Func OnNo()

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

EndFunc

Func OnExit()

if @GUI_CtrlId = $ExitId Then

EndIf

Exit

EndFunc

Edited by roboman
Link to comment
Share on other sites

Lol, but now you have to go into autoit to change the setting.. Still, good work.

Add some information that proxy was changed or not. Right now after you click you gotta guess if it worked or not :lmao: Make it to work in Mozilla FireFox too. Add Miranda support and other comunicators support too. Then i'll surely use it. And add some options to choose between few proxy servers? (some list box)

It's nice script for ppl that change proxy a lot in their everydays life :ph34r:

Make it more advanced :geek: This one is simple but still does it's job.

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

To enable the proxy in Firefox...

msgBox (0, 'Focus Firefox', 'Please press OK, and activate the Firefox window.');
opt ('WinTitleMatchMode', 4);
winWaitActive ('classname=MozillaUIWindowClass');
opt ('WinTitleMatchMode', 1);
send ('!to');
winWaitActive ('Options');
opt ('MouseCoordMode', 2);
mouseClick ('primary', 40, 20, 1, 0);
sleep (150);
send ('!o');
winWaitActive ('Connection Settings');
send ('!m');
sleep (150);
send ('{Enter}');
sleep (150);
send ('{Tab}{Enter}');
msgBox (0, 'Finished', 'Proxy Activated!');

You need to set a focus of Firefox and it will do the rest,

maybe you can implement it to make it do things better.

To disable the proxy, just change

send ('!m');

to

send ('!d');

Link to comment
Share on other sites

  • 3 months later...

My way to do it:

An AutoIT script compiled and a shortcut created on the Favourites/Links pointing to the exe file; if you choose to see the Links Bar , that shortcut will appear as a "button" which will toggle the proxy on/off at each press.

My script is a very simple one; since the "button" to run it it is on IE, this assure that IE window is active.

Send("!to")
WinWaitActive("Internet Options", "Home page")
Send("+{TAB}")
Send("{RIGHT 4}")
WinWaitActive("Internet Options", "To set up an Internet connection, click Setup.")
Send("+{TAB 3}")
Send("{ENTER}")
WinWaitActive("Local Area Network (LAN) Settings", "Automatic configuration")
Send("{TAB}")
Send("{SPACE}")
Send("{ENTER}")
WinWaitActive("Internet Options", "To set up an Internet connection, click Setup.")
Send("{TAB}")
Send("{ENTER}")

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

How about a proxy toggler?

$ProxyEnabled = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable')
If $ProxyEnabled = 0 Then   
    RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable','REG_DWORD',1)
    MsgBox(0," Proxy Toggle","Proxy is now ON",2)
Else
    RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable','REG_DWORD',0)
    MsgBox(0," Proxy Toggle","Proxy is now OFF",2)
EndIf
----[ SandyD ]---
Link to comment
Share on other sites

How about a proxy toggler?

$ProxyEnabled = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable')
If $ProxyEnabled = 0 Then   
    RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable','REG_DWORD',1)
    MsgBox(0," Proxy Toggle","Proxy is now ON",2)
Else
    RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyEnable','REG_DWORD',0)
    MsgBox(0," Proxy Toggle","Proxy is now OFF",2)
EndIf
way better - good job :)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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