Jump to content

Busy Bar & updating Gui Text


Recommended Posts

I'm trying to create a progres bar something like the Win XP Boot screen that just loops infinitely while a function is running. I'm extremely new to this and am just trying to give users a way to know if the program is working or not. Because there maybe multiple steps to the functions I'm also trying to display text in the GUI saying which steps are currently running, and which ones are done, and will clear the area, when another button is pressed. Below is an example of what I want a function to do. Any help is appreciated. Thanks in advance!!!

Func script()
    *Start busy bar*
    *Clear gui area for text*
    *Display "step 1..." in gui
    step 1
    *Display "step 1...Done" in gui
    *Display "Step 2..." in gui
    step 2
    *Display "Step 2...Done" in gui
    * Stop busy bar*
EndFunc
Link to comment
Share on other sites

  • Moderators

AlchemistZim,

Welcome to the AutoIt forum. ;)

The infinite progress you are looking for is known as a "marquee" progress and is created thus:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE)
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

As to the list of steps, take a look at GUICtrlCreateList in the Help file - it should do just what you need. :)

If you are new to scripting, then reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. :P

Give it a go yourself - you know where we are if you run into diffculties. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

AlchemistZim,

Welcome to the AutoIt forum. ;)

The infinite progress you are looking for is known as a "marquee" progress and is created thus:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE)
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

As to the list of steps, take a look at GUICtrlCreateList in the Help file - it should do just what you need. :)

If you are new to scripting, then reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

I know you want to start coding NOW, but a little study will save you a lot of trouble later on, believe me. :P

Give it a go yourself - you know where we are if you run into diffculties. ;)

M23

i've been using batch scripts since i started working on computers, but you can only go so far with those. in a day with the help files, and the forum i've done alot check it out. the problem that i was having with this was that i didn't know the correct terminolgy to use when searching for answers...ex. marquee vs progress...thanks for the help. PS...AutoIt is amazing, and a huge thanks to the author of Koda

PNC.au3

Link to comment
Share on other sites

Never new how to do them, thanks M23

how about an alternative vertical one

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGUI = GUICreate("Test", 500, 500)
GUICtrlCreateProgress(10, 10, 20, 400, BitOR($PBS_MARQUEE,$PBS_VERTICAL))
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 20) ; final parameter is update time in ms
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

ok i've figured out the list box and the marquee, the one problem that i'm running into is updating an already existing line. Below will add a line to the list, but how do i update an existing line. basically how do i change text on an existing line???

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $MESSAGE = "The following buttons have been clicked"
    Local $add1, $add2, $add3, $clear, $mylist, $close, $msg
    
    GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

    $add1 = GUICtrlCreateButton("Add-1", 64, 32, 75, 25)
    $add2 = GUICtrlCreateButton("Add-2", 64, 64, 75, 25)
    $add3 = GUICtrlCreateButton("Add-3", 64, 96, 75, 25)
    $clear = GUICtrlCreateButton("Clear", 64, 128, 75, 25)
    $mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 200, 97)
    GUICtrlSetLimit(-1, 200)    ; to limit horizontal scrolling
    GUICtrlSetData(-1, $MESSAGE)
    $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)

    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()

        Select
            Case $msg = $add1
                GUICtrlSetData($mylist, "You clicked button No1|")
            Case $msg = $add2
                GUICtrlSetData($mylist, "You clicked button No2|")
            Case $msg = $add3
                GUICtrlSetData($mylist, "You clicked button No3|")
            Case $msg = $clear
                GUICtrlSetData($mylist, "")
            Case $msg = $close
                MsgBox(0, "", "the closing button has been clicked", 2)
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Example
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...