Sign in to follow this  
Followers 0
immerume2

Not as much of a noob?

4 posts in this topic

Due to some help from Herewasplato my script below is working to simply uncheck or check the proxy settings box under Lan settings in internet options. Some people in the office would like to use it but gave me a good idea for improving it.

#include <GuiConstants.au3>

GUICreate("Option", 225, 190)
GUISETFONT(10,200,-1,"MS Sans Tarriff");

$User = @username

$HelpMenu = GUICtrlCreateMenu("&Help")
$HelpItem = GUICtrlCreateMenuItem("&About This App",$HelpMenu)



$BrkTravel = GUICtrlCreateButton("&Traveling",115,35,85,35)
$BrkHome = GUICtrlCreateButton("&Home", 20, 35, 85, 35)
$BrkEnd = GUICtrlCreateButton("&Cancel", 70, 130,84, 25)
;~ GUICTRLCREATEBUTTON(

GUISetState()
While 1 ; start loop, so the script continues and does not exit.
    
    $msg = GUIGetMsg() ; listen for a message.
    
    If $msg = $GUI_EVENT_CLOSE Or $msg = $BrkEnd Then ; if exit is pressed, then exit the script.
        MsgBox(0,"Exit","Goodbye!")
        Exit
    EndIf
    
    If $msg = $BrkHome Then ; Change the internet options to the home branch settings when Selected.
        
        $HomeBranch = StringLeft($User,3)
        $Address = "Blah." & $HomeBranch & ".Blah"
        
        BlockInput(1)
        Run("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4")
        WinWait("Internet Properties")
        WinActivate("Internet Properties")
        WinWaitActive("Internet Properties")
        ControlClick("Internet Properties","&LAN Settings...",1580,"left",1,35,9)
        WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlClick("Local Area Network (LAN) Settings", "Use a pro&xy server for your LAN",1570,"left",1,6,17)

        WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlCLick("Local Area Network (LAN) Settings", "OK",1)
        WinWaitClose("Local Area Network (LAN) Settings", "OK")

        WinWait("Internet Properties")
        WinActivate("Internet Properties")
        WinWaitActive("Internet Properties")
        ControlCLick("Internet Properties", "OK",1)
        WinWaitClose("Internet Properties", "OK")
        
        BlockINput(0)
        
        MsgBox(0,"Turn On/Off Nss","Done!!")
        Exit
    ElseIf $msg = $BrkTravel Then ; Change the internet options to the traveling branches proxy.
        $Office = InputBox("Office","What office are you in?","XXX","",200,130)
        $Address = "Blah." & $Office & ".Blah"
        
        BlockInput(1)
        Run("rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4")
        WinWait("Internet Properties")
        WinActivate("Internet Properties")
        WinWaitActive("Internet Properties")
        ControlClick("Internet Properties","&LAN Settings...",1580,"left",1,35,9)
        WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlClick("Local Area Network (LAN) Settings", "Use a pro&xy server for your LAN",1570,"left",1,6,17)

        WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlCLick("Local Area Network (LAN) Settings", "OK",1)
        WinWaitClose("Local Area Network (LAN) Settings", "OK")

        WinWait("Internet Properties")
        WinActivate("Internet Properties")
        WinWaitActive("Internet Properties")
        ControlCLick("Internet Properties", "OK",1)
        WinWaitClose("Internet Properties", "OK")
        
        BlockINput(0)
    EndIf
    
    
    If $msg = $HelpItem Then
        MsgBox(0,"Info","Running this script will automatically change your proxy settings.")
    EndIf
    
       
WEnd ; end loop.oÝ÷ Ù*&z¨¦W¢Ø^¡÷âqì(ºWeG­¢ëÖzg×~âè¾)àÕ¡z{kj÷¥x-êk£¬z»Þ­§]­ë,r§ë«b³r"¯y§]yا¶ªºS­«Þ)àªê-jwjºG¢gªº[ºÛhËhv'Þ­éí«^F(-z0jYmë®*mv¬Ç!yÉÛ§rØ^nV«HÂ¥vX¤z+m¡Ú"²·¢   âÍ趣¬rçh®'â¶+.È^rGRwè®Û§j×¥ÊØ^­çhzÉ赪iyªí¡·v'ßz·§qæÞ·Ø^rç[£§vÞ¶­Ë§rçb­ VwhÀß 
i:)ත!Ø~)ÝËazØ^i×kzËé]Éuè§iËb½ì!z{ayÈ^rFèÆ+rN¬r§ë-ë-ÊW¨~Ø^i×kzËé]'ßÛly橧¶ÞiÛ-ÊW¨}§âzWnëm¢qޭ謶¬yËb¢|!z·Â¥vX¤zÚuÛ(ëax-¢·¢  âÍì!zØ^®Ø^¦º1ÊÇ­¶)౺1Ç!yÉvîÈ^rGjëh×6      WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlClick("Local Area Network (LAN) Settings", "Use a pro&xy server for your LAN",1570,"left",1,6,17)

;~      New code here
;~      then if the check box is now checked use a send to take out what is in the address field and put in the new setting.
;~      I think I know how to do the send to put the right info in part.

        WinWait("Local Area Network (LAN) Settings","Use a pro&xy server for your LAN")
        WinActivate("Local Area Network (LAN) Settings")
        WinWaitActive("Local Area Network (LAN) Settings")
        ControlCLick("Local Area Network (LAN) Settings", "OK",1)

I have tried just throwing the address in there but if the checkbox is not checked it throws commands to the window to change a bunch of other settings instead of ignoring the send that i used because the field is inactive. Any help for a clueless noob on this one would be great. Thanks.

Share this post


Link to post
Share on other sites



Haven't tried that yet. Will try that command. I tried searching for key words that I could think it would be under and did not come across that command. Thanks for the quick reply.

Share this post


Link to post
Share on other sites

Worked like a champ. Thanks a lot.

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