Sign in to follow this  
Followers 0
Vindicator209

Using the progress bar

5 posts in this topic

Well, I'm making a file copying program that copies folders to another folder, and I want to be able to monitor the progress via a progressbar, can anyone show me how to do that?

I'm using DirCopy() to copy the folder.

Thanks.


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



I've seen several version so a filecopy with a progress bar where the progress bar monitors an individual file but I haven't seen one for DirCopy. Why not just use a FileListToArray() and then an individual FileMove()... that would let you create you're progress bar.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Well, at first glance I saw that DirCopy can copy the whole folder(including its contents) so I figured that was what to use. I guess I can use FileMove but it might cost another chunk of script (replacing them into the correct folders & such) but I still don't know how I can show the progress bar moving...

See, its not just a folder with a couple of files, its a few files in a folder, in another folder, with a few other folders with files in them, inside another folder...and if you haven't guessed, im making a "universal" install program for some game, so im guessing my line of script might be along the lines of

$array = _FileListToArray($folder)

For $i = 1 to $array[0]

FileCopy($array[$i],$destination)

Next

Problem is, not only are there folders inside folder, there are also files inside folders inside the source folder...follow? And I doubt FileCopy() also applies to folders so theres a road block too.. ahh my brain hurts....

Could you please show me one or two examples that you've seen so I can use them?

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

This is what I use in my multiple desktops program (edited a bit)... I haven't tested this much so I'm not sure how reliable it is...

#include <File.au3>

_DirMove('C:\Multiple Desktops', 'C:\TESTING TESTING\Multiple Desktops')

Func _DirMove($from, $to)
    $files = _FileListToArray($from, "*.*", 1)
    $folders = _FileListToArray($from, '**', 2) 

    If Not FileExists($to) then DirCreate($to)

    $total = 0
    $index = 1
    If IsArray($files) then 
        $total += $files[0] 
    EndIf 

    If IsArray($folders) then 
        $total += $folders[0] 
    EndIf 
    ProgressOn('Moving Folder', 'Current status:', '0%')
    If IsArray($files) then
        For $a = 1 to $files[0] 
            FileMove($from & '\' & $files[$a], $to, 1)
            ProgressSet($index * $total/100, Round($index * $total/100, 2) & '%')
            $index += 1
        Next
    EndIf


    If IsArray($folders) then 
        For $a = 1 to $folders[0]  
            DirMove($from & '\' & $folders[$a], $to, 1)
            ProgressSet($index * $total/100, Round($index * $total/100, 2) & '%')
            $index += 1
        Next
    EndIf
    
    DirRemove($from)
EndFunc

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I tried this, it gets stuck at 0.25% for some reason, I'll look into it

Edit: Thanks by the way

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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