Jump to content
Sign in to follow this  

Close 2nd GUI without closing 1st GUI

Recommended Posts


I'm trying to write a util to quickly set/view/renew IP parameters and have a main form that seems to generally work. I click on the Set Static IP button which calls up a second GUI to input the parameters, but I can't figure out how to close the 2nd window without shutting down the whole thing. I'm new to AutoIT and a fairly poor programmer anyway.

Any help is appreciated.

to help decoding it

function loadup - loads an "ipconfig /all" into a variable, parses it out into an array

Function Display - runs the initial GUI

Function SetStatic - runs when the Set Static IP button is pushed & opens the 2nd GUI with some default values in the boxes and passes the adapter name for setting the IP address.

You have to pick an adapter in the combo box before the Set Static IP button will do anything.


Share this post

Link to post
Share on other sites

GUIDelete ( [winhandle] )


OK, that makes the window go away, something I hadn't accomplished yet, but now the main window is completely un-responsive.

I tried doing a GUISwitch before the GUIDelete but that didn't help.

Any other ideas?

Share this post

Link to post
Share on other sites

This is from you SetStatic function

While 1
    $msg = GuiGetMsg()
    Case $msg= $GUI_EVENT_CLOSE or $msg = $btnClose
    Case $msg = $BtnSetIP
    $ip = GUICtrlRead($input_1) & "." & GUICtrlRead($input_2) & "." & GUICtrlRead($input_3) & "." & GUICtrlRead($input_4 )
    $subnet = GUICtrlRead($input_5) & "." & GUICtrlRead($input_6) & "." & GUICtrlRead($input_7) & "." & GUICtrlRead($input_8 )
    $gateway = GUICtrlRead($input_9) & "." & GUICtrlRead($input_10) & "." & GUICtrlRead($input_11) & "." & GUICtrlRead($input_12 )
    $dns1 = GUICtrlRead($input_13) & "." & GUICtrlRead($input_14) & "." & GUICtrlRead($input_15) & "." & GUICtrlRead($input_16)
    $dns2 = GUICtrlRead($input_17) & "." & GUICtrlRead($input_18) & "." & GUICtrlRead($input_19) & "." & GUICtrlRead($input_20 )
    runwait(@comspec & ' /c netsh interface ip set address "Local Area Connection" static' & " " & $ip & " " & $subnet & " " & $gateway & " 1","")
    run(@comspec & ' /c netsh interface ip set dns "Local Area Connection" static '  & $dns1 & " primary","")

SciTE for AutoItDirections for Submitting Standard UDFs


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


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.