genbadger Posted September 28, 2010 Posted September 28, 2010 Hey there! I have an issue that has been plaguing me. I am trying to retrieve the text typed into an input box, but it returns "Network name here". I need it to be what ever the user types into the box. Here is the code. I also have a file for the code. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form2 = GUICreate("MyNetwork", 429, 212, 494, 236) $Button1 = GUICtrlCreateButton("Make a new Network", 8, 16, 145, 33, $WS_GROUP) $Button2 = GUICtrlCreateButton("Start", 8, 56, 145, 33, $WS_GROUP) $Button3 = GUICtrlCreateButton("Stop", 8, 96, 145, 33, $WS_GROUP) $Button4 = GUICtrlCreateButton("Refresh", 8, 136, 147, 33, $WS_GROUP) $Button5 = GUICtrlCreateButton("Status", 8, 176, 145, 33, $WS_GROUP) $Input1 = GUICtrlCreateInput("Network name here", 160, 24, 241, 21, $ES_NOHIDESEL) $Input2 = GUICtrlCreateInput("password", 160, 64, 241, 21) $Checkbox1 = GUICtrlCreateCheckbox("Hide characters", 160, 88, 113, 17) $Label1 = GUICtrlCreateLabel("Name of Network", 160, 8, 200, 17) $Label2 = GUICtrlCreateLabel("Password (min. of 8 characters)", 160, 48, 200, 17) $str1 = GUICtrlRead($Input1) $str2 = GUICtrlRead($Input2) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg =$Button5 run("cmd") WinActivate ( "cmd" ) sleep ( 500 ) send("netsh wlan show hostednetwork") send( "{enter}") Case $msg =$Button1 run("notepad") WinActivate ( "notepad" ) sleep ( 500 ) send("netsh wlan set hostednetwork mode=allow ssid=" & $str1 ) Case $msg =$Button3 run("cmd") WinActivate ( "cmd" ) sleep ( 500 ) send("netsh wlan stop hostednetwork") send( "{enter}") Case $msg =$Button4 run("cmd") WinActivate ( "cmd" ) sleep ( 500 ) send("netsh wlan refresh hostednetwork") send( "{enter}") EndSelect WEnd GUIDelete() ExitGUI for network.au3
MattyD Posted September 28, 2010 Posted September 28, 2010 Hey mate, GUICtrlRead() will only read the control at the point you call it. you need to put this line: $str1 = GUICtrlRead($Input1) after the case statement on line 38 Matt
genbadger Posted September 29, 2010 Author Posted September 29, 2010 Hey mate, GUICtrlRead() will only read the control at the point you call it. you need to put this line: $str1 = GUICtrlRead($Input1) after the case statement on line 38 Matt Thank you so much man! It worked perfectly!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now