Jump to content

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.

nettest2b.au3

Link to comment
Share on other sites

GUIDelete ( [winhandle] )

<{POST_SNAPBACK}>

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?

Link to comment
Share on other sites

This is from you SetStatic function

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg= $GUI_EVENT_CLOSE or $msg = $btnClose
        GUIDelete($staticwindow)
        ExitLoop
    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","")
    
    
    
    EndSelect
WEnd
EndFunc

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