Sign in to follow this  
Followers 0
makeinstall

Simple script progress feedback to a GUI

7 posts in this topic

#1 ·  Posted (edited)

I'm trying to work out the best way to get simple visual feedback of what the script is doing but without using msgbox as I do not want the script to pause, awaiting user input.

For instance, one script I'm working on downloads a zip file from a server and displays a progress bar but leading up to that, it checks the local folder structure exists [if not, creates] and if a copy of the file exists locally & deletes if it does. How can I have a simple panel that says something like?:

- checking if folder structure exists....

- it does not so will create....

- folders created.

- checking if remote file exists....

- it does. beginning download....

etc etc

There might be a very simple solution but I haven't really done anything with a GUI as of yet so its all new territory and everything I have read so far has been confusing so I would really appreciate if anyone could tell me what functions I should be reading up on.

Thanks in advance for any help or pointers anyone can offer.

Edited by makeinstall

Share this post


Link to post
Share on other sites



makeinstall,

Here is one way you might like to do it:

#include <GUIConstantsEx.au3>
#include <ListboxConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hList = GUICtrlCreateList("", 10, 10, 200, 200, $LBS_NOSEL)

$hButton = GUICtrlCreateButton("Exit", 10, 250, 80, 30)

GUISetState()

Sleep(1000)
GUICtrlSetData($hList, "- checking if folder structure exists....")
Sleep(1000)
GUICtrlSetData($hList, "- it does not so will create....")
Sleep(1000)
GUICtrlSetData($hList, "- folders created")
Sleep(1000)
GUICtrlSetData($hList, "- checking if remote file exists....")
Sleep(1000)
GUICtrlSetData($hList, "- it does. beginning download....")

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

In your Gui

$progresstxt=GuiCtrlCreateLabel("Status:", 0, 0)

Then before each action add this

GUICtrlSetData ( $progresstxt, "doing this or that")

Not sure if this was what you mean. but i hope so

Edit: Check post above thats a more clear example =]

Edited by Hellstrong

Share this post


Link to post
Share on other sites

Thanks for the prompt reply.

The main function that sends data to the GUI is GUICtrlSetData?

So I would just insert that function call at the various places in my script to indicate a milestone has been reached / about to be executed, with the GUI creation at the start & the While loop at the end?

Looking structure wise something like this?

#includes

GUICreate()

GUISetState()

; my script function calls
GUICtrlSetData($hList, $messageToDisplay)

;etc etc

While 1
; blah blah
Wend

Also, where can I find more about the various calls of globals such as "$LBS_NOSEL" because I cant seem to find a page that lists them all like in the docs for @macros or functions?

Once again, thanks for your help.

Share this post


Link to post
Share on other sites

makeinstall,

So I would just insert that function call at the various places in my script to indicate a milestone has been reached / about to be executed, with the GUI creation at the start & the While loop at the end?

You have it in one! :) Your code just replaces the Sleep commands.

where can I find more about the various calls of globals such as "$LBS_NOSEL"

These are style constants - usually stored in the *Constants.au3 include file for that type of control (did you notice the #include <ListboxConstants.au3> line? ;) ). You can find the styles that refer the particular control in the Help file - look at the relevant GUICtrlCreate* page and then under the style and exStyle parameter explanation, there is a link to the appropriate Help file selections there.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Sorry to bump this back up but I have some more questions about the styling of a GUI:

When I have sent various statements to the GUI through GUICtrlSetData($hList, "[message.....]"), it does not scroll when the listbox area fills up. How can I do this? I have tried looking through the styles list but cannot see one associated with 'overflow'.

Also, is there anyway to style the text being sent to the GUI? Style as in send in bold or italics for instance?

Once again, TIA anyone who can help.

Share this post


Link to post
Share on other sites

makeinstall,

Everything you want to do is possible. Please post your code so we can see exactly what you are trying to do - it is always easier when you have something to work on. ;)

M23

P.S. When you post your script, please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here).


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

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  
Followers 0