Jump to content

Help with progress bar please

Recommended Posts

Help, Would Anyone mind posting an example of how to update a progress bar based on the size of a file being copied?

Here's my attempt after looking in the man pages..I know I an still far off but

How do I set the prgress bar as a percentage of the file ? then update it in the gui?

Sorry to be so dense about this, Dummy step be step isntructions will not be offensive :lmao:

Func InstallJavaPressed()
        GuiCreate("Installing Java ", 369, 125,(@DesktopWidth-469)/2, (@DesktopHeight-639)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
        GUICtrlCreateLabel("Installing JRE",10,10,150)
        if FileExists("D:\Installer\jre1.5.0_01.exe")Then
            $f = FileGetSize("D:\Installer\jre1.5.0_01.exe")
            MsgBox(262144,'debug line ~188' , 'FileGetSize("D:\Installer\jre1.5.0_01.exe"):' & @lf & FileGetSize("D:\Installer\jre1.5.0_01.exe"));### Debug MSGBOX
            FileInstall("D:\Installer\jre1.5.0_01.exe","C:\Program Files\Java Runtimes\jre1.5.1_01",1)
            $wait = 20; wait 20ms for next progressstep
            $s = 0; progressbar-saveposition
                $msg = GUIGetMsg()
                        For $i = $s To $f
                            $m = GUIGetMsg ()
                            GUICtrlSetData ($javaPB,$i)
                until $msg = $GUI_EVENT_CLOSE
            msgbox (4096,"Source Error", "Source for JAVA_JRE invalid",5)

Edited by Larry
Link to post
Share on other sites

FileInstall is a "blocking" command, so the script will not continue, until the file is fully copied (installed)... To get a progessbar for a copy, you can manage a DLLCall... but to ProgressBar a "FileInstall"... I can't think of a way...

best I could figure, is... you could launch a second script (or second instance of the current script using $cmdline parameters) and have it do the file install. It can set an indicator just before the fileinstall... the script sees this indicator and starts a progress-like animation... when the fileinstall is finished it can set a file done type indicator so that the animation can stop... it will not be a true progess bar, but a "copy in progress" indicator...



Or to take that a little further, just have the secondary script get sent the file size of the file being copied and have it poll every 5 seconds or whatever the destination file size.
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...