daging_panas Posted September 25, 2015 Share Posted September 25, 2015 i am new to autoIT, and reading some of the tutorial. my code below should work as it is a simple code. but it won't close although i press the close button. What is wrong? need some help #include <GUIConstantsEx.au3>GUICreate("Komo", 335, 100)GUISetState(@SW_SHOW)GUICtrlCreateLabel("Key", 8, 10)$key1 = GUICtrlCreateInput("", 35, 8, 120)GUICtrlCreateLabel("Time", 8, 44)$time1 = GUICtrlCreateInput("", 35, 40, 120)$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)While 1 $msg = GUIGetMsg() Select Case $msg = $startbutton $send1 = GUICtrlRead($key1) $sleep1 = GUICtrlRead($time1) While 1 Send($send1) Sleep($sleep1) WEnd Case $msg = $GUI_EVENT_CLOSE GUIDelete ExitLoop EndSelectWEnd Link to comment Share on other sites More sharing options...
water Posted September 25, 2015 Share Posted September 25, 2015 Welcome to Autoit and the forum!The Close Button works fine. But as soon as you press the start button your script goes into an infinite loop because you never leave the While loop.Is this script just to practice or do you want to solve a real problem? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
daging_panas Posted September 25, 2015 Author Share Posted September 25, 2015 (edited) actually, it is for both purpose. i will develop it later. so, how can i leave the while loop? and which while loop? the inside one or the outside one? sorry noob question Edited September 25, 2015 by daging_panas Link to comment Share on other sites More sharing options...
water Posted September 25, 2015 Share Posted September 25, 2015 The inner loop wich processes the start button. It's up to you to decide which condition needs to be met to exit the loop.What do you try to achieve with your script Means: Which program do you try to automate?Maybe it is then easier to tell you how to code the While loop. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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