Jump to content

Multiple file copy progressbar problem


fs1234
 Share

Recommended Posts

Hi Guys,

 

Help me, pls!

How can I do the progress of $SourceFullSize in the $ProgressBar2 with the Round($o / $Chunks)?

 

$SourceSize = FileGetSize(@ScriptDir & "\test.zip")
                $SourceFullSize = FileGetSize(@ScriptDir & "\test.zip") * 8
                For $i = 1 To 8                 
                    GUICtrlSetData($ProgressLabel1, "8/" & $i & ":")
                    $Source = FileOpen(@ScriptDir & "\test.zip", 16)
                    $Dest = FileOpen(@ScriptDir & "\" & $i & "\test.zip", 26)                    
                    $Chunks = $SourceSize / 2048
                    For $o = 0 To $Chunks
                        FileWrite($Dest, FileRead($Source, 2048))
                        GUICtrlSetData($progressbar1, Round(($o / $Chunks) * 100))
                        ;GUICtrlSetData($progressbar2, $i * (Round(($o / $Chunks) * 100))) Progress of $SourceFullSize                      
                    Next
                    FileClose($Dest)
                    FileClose($Source)                  
                Next

Thanks

Link to comment
Share on other sites

fs1234 -

You might also take a look at the help file and search for  _WINAPI_MoveFileEx.au3.  It references a function that creates a progress bar during file moves.  The code is useable as is but can be tweaked.

I use it, occassionally, as part of an app that moves multi-gigabyte files around.   You might be able to adapt that to what you're trying to do when reading and writing lines to files at roughly the same time.

Note that although it works, for reasons I have not been able to figure out or had time to research, the progressbar dialog disappears from the screen if I try to move it.  It doesn't seem to affect the files getting moved. 

You'll need to use ProgressOn and ProgressOff as part of the function.  ProgressOn gives you options to move the dialog box and to turn off the default "always on top" behavior of the dialog. 

There's also ways to display several lines of data on the progressbar to show additional info.  i.e., I added the following

$sTransferred = Round($iTotalBytesTransferred / 1048576, 0) & " MB"
$sTotalSize = Round($iTotalFileSize / 1048576, 0) & " MB"
ProgressSet($iPercent, $iPercent & "%" & " of  " & $sTotalSize & " MB" & @LF & " Transferred: " & $sTransferred)

Good luck.

 

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...