Jump to content

Recommended Posts

Posted

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

 

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
×
×
  • Create New...