DigDeep

Progress Bar

7 posts in this topic

As per the example for the Progress bar, I am trying to keep it in between a function so that when the Run command starts the Progress bar would start and when the program ends so should the progress bar window too.

My code and progress window start together but the progress bar percentage only starts when the program gets completed. Both program and progress bar do not run together.

Can anyone help ?

 

Example()

Func Example()
    ; Display a progress bar window.
    ProgressOn("Progress Meter", "Increments every second", "0%")

; Run(Program /silent)

    ; Update the progress value of the progress bar window every second.
    For $i = 10 To 100 Step 10
        Sleep(1000)
        ProgressSet($i, $i & "%")
    Next

    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    Sleep(5000)

    ; Close the progress window.
    ProgressOff()
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites



Your code runs fine for me.  Look at how/where your program running code is placed in relationship to your progress bar code.


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

There is no issue with the example... But my installation doesn't shows the Progress bar moving at the correct time of installation of my programs.

Say as an example I am trying to get the VLC player installation with the progress bar.

As per the below code, The progress bar displays but never moves and installation starts later on.

I would need the progress bar to start when the func starts and progress bar % should show while all the operations happening at the correct time and end up when all the operations ended.

 
#RequireAdmin

#include <File.au3>
#include <IE.au3>
#include <ProgressConstants.au3>

Global $Path

Global $VLC_Site = "http://mirror.nexcess.net/videolan/vlc/2.2.1/win32/vlc-2.2.1-win32.exe"

VLC()

Func VLC()

        ; Display a progress bar window.
        ProgressOn("VLC", "VLC Player Installing", "0%", 30, 50, 16)

        $Path = @TempDir & "\VLC"
        DirCreate($Path)
        InetGet($VLC_Site, $Path & "\vlc-2.2.1-win32.exe", "", @SW_HIDE)

        RunWait($Path & "\vlc-2.2.1-win32.exe /L=1033 /S")

        ; Update the progress value of the progress bar window every second.
        For $i = 1 To 100 Step 1
            Sleep(100)
            ProgressSet($i, $i & "%")
        Next

        ; Set the "subtext" and "maintext" of the progress bar window.
        ProgressSet(100, "", "Complete")
        Sleep(1000)

        ; Close the progress window.
        ProgressOff()
EndFunc

 

Edited by sunshinesmile84

Share this post


Link to post
Share on other sites

Well....

RunWait($Path & "\vlc-2.2.1-win32.exe /L=1033 /S")

This line pauses your scripts until the program dies, Try: 

Run($Path & "\vlc-2.2.1-win32.exe /L=1033 /S")

TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Your ProgressSet parameters are still the same as the Example

So it will in effect start and stop just exactly like the example does in the middle of your script regardless of what your program does.

You have to set the ProgressSet with something else, inetget might give you some info back to use but I have never tried it.

 

Her is a n example of what I mean:

Example()

Func Example()

    ; Display a progress bar window.
    ProgressOn("Progress Meter", "Begin setup process", "0%")

    ; Update the progress value of the progress bar window.
    Sleep(1000)
    ProgressSet(20 & "%", "VLC Downloaded Successfully")
    Sleep(1000)
    ProgressSet(40 & "%", "VLC Installed Succesfully")
    Sleep(1000)
    ProgressSet(60 & "%", "Clean up in Progress")
    Sleep(1000)
    ProgressSet(80 & "%")
    ; Set the "subtext" and "maintext" of the progress bar window.
    ProgressSet(100, "Done", "Complete")
    Sleep(5000)

    ; Close the progress window.
    ProgressOff()
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

@TheDcoder

Run command works here in place of Runwait... The problem is that VLC is not such a big file so using Run here seems all good.

 

The program I am using takes around 30 minutes to install. If I use Run over there then the progress bar shows as installed within few secs and gets completed but then the installation is still running at the background. Which is a problem...

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