DoctorSLO Posted January 17, 2009 Share Posted January 17, 2009 (edited) Hi I'm beginner in autoit. Here is my example script: #include <GUIConstantsEx.au3> GUICreate("Hello World", 500, 100) $Input = GUICtrlCreateInput("input here", 10, 10) $Button = GUICtrlCreateButton("OK", 250, 10) GUISetState(@SW_SHOW) Local $Sleep While 1 $msg = GUIGetMsg() Select Case $msg = $Button $Input = $Sleep //this is not correct EndSelect WEnd Sleep($Sleep) //And more code following .... Now I know this is wrong, I'm asking you how to do it correct. I want that the number I entered in Input set the $Sleep variable. I do this like this $Input = $Sleep, but something is missing, plz help ... thx And I also need that GUI interface close when Sleep variable is set. Edited January 17, 2009 by DoctorSLO Link to comment Share on other sites More sharing options...
BugFix Posted January 17, 2009 Share Posted January 17, 2009 Look at GUICtrlRead Best Regards BugFix Link to comment Share on other sites More sharing options...
rasim Posted January 17, 2009 Share Posted January 17, 2009 Welcome to the forum! Use a GuiCtrlRead function to get a data of the control.#include <GUIConstantsEx.au3> GUICreate("Hello World", 500, 100) $Input = GUICtrlCreateInput("input here", 10, 10) $Button = GUICtrlCreateButton("OK", 250, 10) GUISetState(@SW_SHOW) Local $Sleep While 1 $msg = GUIGetMsg() Select Case $msg = $Button $Sleep = GUICtrlRead($Input) MsgBox(0, "Sleep", $Sleep) EndSelect WEnd Link to comment Share on other sites More sharing options...
DoctorSLO Posted January 17, 2009 Author Share Posted January 17, 2009 Thank you, I do it. I just want to know how to close GUI when I press OK button on msgbox that appeared. I put $GUI_EVENT_CLOSE but its not work And also the MsgBox(0, "Title", "here we go") its not show up . I must put it in while or function ? #include <GUIConstantsEx.au3> GUICreate("Hello World", 500, 100) $Input = GUICtrlCreateInput("input here", 10, 10) $Button = GUICtrlCreateButton("OK", 250, 10) GUISetState(@SW_SHOW) Local $Sleep While 1 $msg = GUIGetMsg() Select Case $msg = $Button $Sleep = GUICtrlRead($Input) MsgBox(0, "ok", "Sleep time is " & $Sleep) EndSelect WEnd Sleep($Sleep) MsgBox(0, "Title", "here we go") Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 You need to exit the While-Wend loop by putting an ExitLoop function inside your Case $msg = $Button.. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DoctorSLO Posted January 17, 2009 Author Share Posted January 17, 2009 (edited) Thx, now its working fine. To close GUI Window I used GUISetState(@SW_HIDE). So now looks like this : #include <GUIConstantsEx.au3> GUICreate("Hello World", 500, 100) $Input = GUICtrlCreateInput("input here", 10, 10) $Button = GUICtrlCreateButton("OK", 250, 10) GUISetState(@SW_SHOW) Local $Sleep While 1 $msg = GUIGetMsg() Select Case $msg = $Button GUISetState(@SW_HIDE) $Sleep = GUICtrlRead($Input) MsgBox(0, "ok", "Sleep time is " & $Sleep) ExitLoop EndSelect WEnd Sleep($Sleep) MsgBox(0, "Title", "here we go") Thx Edited January 17, 2009 by DoctorSLO Link to comment Share on other sites More sharing options...
Developers Jos Posted January 17, 2009 Developers Share Posted January 17, 2009 Normally you would delete the GUI unless you want to display it again at a later stage or still need to read the content of any of the Controls: $Sleep = GUICtrlRead($Input) MsgBox(0, "ok", "Sleep time is " & $Sleep) GUIDelete() ExitLoop Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
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