Jump to content

Recommended Posts

Posted

I know there are a bunch of progress bar examples, but I'm just not understanding it..

What I would like to do is copy a users favorites to a network drive with a progress bar.

This is all I have.

-------------------------------------------------------------------------------------------

$copy = MsgBox(324,"Favorites", "Would you like to copy your Favorites?", "")

if $copy = 7 then

MsgBox(016,"Warning!", "Favorites were not Copied!", "")

exit

else

DirCopy(@FavoritesDir, "C:\Backup\Favorites", "")

if @error = 0 then

MsgBox(064,"Done", "Favorites Copied", "")

else

MsgBox(016,"Done", "Favorites were not Copied", "")

EndIf

Endif

exit

-------------------------------------------------------------------------------------------

I would guess you would need to use $size = FileGetSize() or maby use the "DriveSpaceFree( )

I do a little VB, but I've never understood how this is done, nor can I find material that I can comprehend. Im sure this isnt that hard, I just dont have the basics. Any help would greatly be appreciated! Thanks

Posted

you need FileFindFirstFile to get the name of the files

you also can create a number counter to count how many files. then plug that variable into ProgressSet... and you have to stop using copydir, that will bypass the entire progress thingy...

$search = FileFindFirstFile(@FavoritesDir &"\*.url")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)
Posted

You need an opportunity to update the progress bar: DirCopy doesn't give you that opportunity cos it's just a single command (unless you want to write a tandem script that monitors the directory and IT updates a progress bar? :( )

Here's an example of how the progress bar is updated each cycle in a loop: #26945

HTH :ph34r:

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