Sign in to follow this  
Followers 0
kjcdude

Script Progress Bar?

6 posts in this topic

#1 ·  Posted (edited)

Something like this probably exists, but i've been unable to find it.

I'm looking for a wrapper that i can use to display a progress bar as my script runs.

I found the filecopy progress bar, but it wont work since i need it to monitor my entire script.

Thanks

Edited by kjcdude

Share this post


Link to post
Share on other sites



Something like this probably exists, but i've been unable to find it.

I'm looking for a wrapper that i can use to display a progress bar as my script runs.

I found the filecopy progress bar, but it wont work since i need it to monitor my entire script.

Thanks

; example 1
#include <GUIConstants.au3>

GUICreate("My Tasks", 450, 70)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box

$progressBar = GUICtrlCreateProgress(5,5,400, 20)
$progressPercent = GuiCtrlCreateLabel("0%", 410,7, 40)
$progressTask = GuiCtrlCreateLabel("Task 1 of 5", 5,30, 100)

For $X = 1 to 5
    ;Divide $X by 5, multiple by 100 (progress bar accepts 0-100)
    GuiCtrlSetData($progressBar, ($X / 5) * 100)
    GuiCtrlSetData($progressPercent, (($X / 5) * 100) & "%")
    GuiCtrlSetData($progressTask, "Task " & $X & " of " & 5)
    Sleep(1000)
Next

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Share this post


Link to post
Share on other sites

I see what you did there.

A bit more complicated than i had imagined, but it works just fine.

Thanks

Share this post


Link to post
Share on other sites

Man you take a long time to respond. Holy crap I hope you aren't a fireman.

Share this post


Link to post
Share on other sites

Heheh


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

A bit more complicated than i had imagined, but it works just fine.

The only reason it looks complex is because I was trying to make it seem as if you had 5 tasks to complete. Here is something simpler:

$progressBar = GUICtrlCreateProgress(5,5,400, 20)
For $X = 1 to 100
    GuiCtrlSetData($progressBar,$X)
    Sleep(250)
Next

Basically you can set the progress bar to anything from 1-100.

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