daging_panas

My autoit won't close

4 posts in this topic

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
    EndSelect

WEnd

 

Share this post


Link to post
Share on other sites



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 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by daging_panas

Share this post


Link to post
Share on other sites

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 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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