Jump to content
Sign in to follow this  

First GUI app - Few questions

Recommended Posts


Hi everyone!

This my first GUI app using au3 so any help is appreciated! I just have 3 questions...

1. If you execute a button which contains an endless loop, is there a way to break the cycle so you can pause or exit?

2. How can you add text to a listbox so each new entry goes on a new line and if it exceeds the width of the listbox then it goes to a new line?

3. How do I go about enabling a vertical scroll bar?

Below is sum sample code of my endless loop problem, I want to be able to break the cycle when another button is clicked(if this is possible).


- Alex

#include <GUIConstants.au3>
#include <Array.au3>
GUICreate("+1", 400, 300)
$btn_Run = GUICtrlCreateButton("Run", 10, 10, 100, 25)
$btn_Pause = GUICtrlCreateButton("Pause", 10, 45, 100, 25)
$btn_Exit = GUICtrlCreateButton("Exit", 10, 80, 100, 25)
$lst_Status = GUICtrlCreateList("", 125, 10, 200, 250)
Global $Pause

While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $btn_Exit
        Case $msg = $btn_Pause
            $Paused = NOT $Paused
            While $Paused
                ToolTip('Script is "Paused"',0,0)
        Case $msg = $btn_Run
            While 1; endless loop
            ; do some code

Share this post

Link to post
Share on other sites

Q1- Yes it is possible to break a loop externally. 1 method would be to have a varible, and set it to true/false depending on what you want done in the loop. If you add if $var = true then ExitLoop into your loop, it will exit the loop if $var is true. Also, if you don't already use AdLib in your GUI, you can just use an adlib loop, which would be easy.

Q2- Well a simple function could do that.

Q3- Look in the helpfile for scroll. Should be under UDF's (Latest version from memory)

Give me a bit to get AutoIt back on this stupid loan machine, and I'll get one working for you :)

Share this post

Link to post
Share on other sites

Thank you Bert! Many thanks, ill keep a watch on this thread and implement ur resolution for q1 now :)

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.