Sign in to follow this  
Followers 0
oleg

File Copy Progress

24 posts in this topic

#1 ·  Posted (edited)

How can i create a progress for file / dir copying.

I have searched in the forum but found nothing .

By the way Search function sucks evrything else rocks ;)

Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites



How can i create a progress for file / dir copying.

I have searched in the forum but found nothing .

By the way Search function sucks evrything else rocks ;)

<{POST_SNAPBACK}>

Try looking at this thread

All I searched for was "progress bar" and look at what I found. :P:mad2::oops:



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Will check it out thanks guys ;)


There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

All this is Assembly for me ;)

Isnt there a way to monitor how many data is copied and updeate the progress bar .

From what i found if im not mistaking its impossible to do what i ask with command dircopy / filecopy ?

Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

All this is Assembly for me  ;)

Isnt there a way to monitor how many data is copied and updeate the progress bar .

From what i found if im not mistaking its impossible to do what i ask with command dircopy / filecopy ?

<{POST_SNAPBACK}>

well you could do a quick count of the files to be copied before you start copying, and have a variable incremented at each iteration of your loop. that way you could divide the counter by the count, and use that to figure your progress bar.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I will check it out Larry .

I thought about counting but because some files that will be copied is big 500 megs it will not be precise ;)

Thanks Guys


There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

I will check it out Larry .

I thought about counting but because some files that will be copied is big 500 megs it will not be precise ;)

Thanks Guys

<{POST_SNAPBACK}>

the size of the file doesn't matter to count it... if a file is a gig, it will still be counted just as quickly as a 1k file. you don't need to open the file to count it... check FileFindFirstFile and FileFindNextFile in the helpfile.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

the size of the file doesn't matter to count it... if a file is a gig, it will still be counted just as quickly as a 1k file.  you don't need to open the file to count it... check FileFindFirstFile and FileFindNextFile in the helpfile.

<{POST_SNAPBACK}>

Can you give me a sample .

Im trying to copy a Directory with subdirs and files .

I would like to use dircopy command ;) if possible

Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

Can you give me a sample .

Im trying to copy a Directory with subdirs and files .

I would like to use dircopy command ;) if possible

<{POST_SNAPBACK}>

if you post your code, i can just add the stuff you need.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I managed to make it work but i still don get the effect that i want with neither ways .

As i told you because the files are big the progress bar will stuck like for 30 sec as the file is being copied :mad2: so the user might think that the process stuck :oops: and closes the window .

The other way uses explorer progress bar i cant use it ;)

To bad im out of :P


There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

I managed to make it work but i still don get the effect that i want with neither ways .

As i told you because the files are big the progress bar will stuck like for 30 sec as the file is being copied :oops: so the user might think that the process stuck :dance: and closes the window .

The other way uses explorer progress bar i cant use it  :P

To bad im out of  :mad2:

<{POST_SNAPBACK}>

hm... ;)

if you post your code, i can just add the stuff you need.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

Opt("Trayautopause" ,0)

;Opt ("Trayiconhide" ,1 )

;dim $title

If $CmdLine[0] = 0 Then

MsgBox (016,"Missing Parameters","No Comand Line "&@CRLF&"Options Specified")

Exit

EndIf

$title = $CmdLine[1]

;Server Configuration

$server = IniRead ("config\config.ini","server", "server" , "")

$share = IniRead ("config\config.ini","server", "share" , "")

$directory = IniRead ("config\config.ini","server", "directory" , "")

;Client Configuration

;Title Configuration

$name = IniRead ("config\games.ini",$title, "name" , "")

$source = IniRead ("config\games.ini",$title, "source" , "")

$destination = IniRead ("config\games.ini",$title, "destination" , "")

$exe = IniRead ("config\games.ini",$title, "exe" , "")

$version = IniRead ("config\games.ini",$title, "version" , "")

;Gui Start

$left_p = IniRead ("config\config.ini","position", "left_p" , "")

$height_p = IniRead ("config\config.ini","position", "height_p" , "")

GUICreate ("Game Loader",640,400, $left_p ,$height_p,-1 ,$WS_EX_TOPMOST)

GUICtrlCreatePic ("images\"&$title&".bmp","","","","",$SS_CENTERIMAGE)

GUISetState (@SW_SHOW)

$Main_Progress = GuiCtrlCreateProgress(25, 370, 590, 25,$PBS_SMOOTH)

GUICtrlSetBkColor ($main_Progress ,0x000000)

GUICtrlSetColor ($main_Progress ,0xFF0000)

$size = DirGetSize($server&"\"&$share&"\"&$directory&"\"&$source,1)

$search = FileFindFirstFile($server&"\"&$share&"\"&$directory&"\"&$source&"\*.*")

;MsgBox (0,"",$search)

If $search = -1 Then

MsgBox(01600262144, "Error", "Installation Files Not Found"&@CRLF&"Please Contact Employee")

Exit

EndIf

$b = 0

$i = $size[1]

DirCreate($destination)

While Not $i = 0

$file = FileFindNextFile($search)

$i = $i - 1

$b = $b + 1

FileCopy ($server&"\"&$share&"\"&$directory&"\"&$source&"\"&$file , $destination ,1 )

GUICtrlSetData ($Main_Progress ,$;)

Sleep (100)

If @error Then ExitLoop

;MsgBox (0,"",$i)

;MsgBox(4096, "File:", $file)

WEnd


There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode

Opt("Trayautopause" ,0)

;Opt ("Trayiconhide" ,1 )

;dim $title

If $CmdLine[0] = 0 Then

MsgBox (016,"Missing Parameters","No Comand Line "&@CRLF&"Options Specified")

Exit

EndIf

$title = $CmdLine[1]

;Server Configuration

$server    = IniRead ("config\config.ini","server", "server" , "")

$share    = IniRead ("config\config.ini","server", "share" , "")

$directory = IniRead ("config\config.ini","server", "directory" , "")

;Client Configuration

;Title Configuration

$name        = IniRead ("config\games.ini",$title, "name" , "")

$source      = IniRead ("config\games.ini",$title, "source" , "")

$destination = IniRead ("config\games.ini",$title, "destination" , "")

$exe        = IniRead ("config\games.ini",$title, "exe" , "")

$version    = IniRead ("config\games.ini",$title, "version" , "")

;Gui Start

$left_p      = IniRead ("config\config.ini","position", "left_p" , "")

$height_p    = IniRead ("config\config.ini","position", "height_p" , "")

GUICreate ("Game Loader",640,400, $left_p ,$height_p,-1 ,$WS_EX_TOPMOST)

GUICtrlCreatePic ("images\"&$title&".bmp","","","","",$SS_CENTERIMAGE)

GUISetState (@SW_SHOW)

$Main_Progress = GuiCtrlCreateProgress(25, 370, 590, 25,$PBS_SMOOTH)

GUICtrlSetBkColor ($main_Progress ,0x000000)

GUICtrlSetColor  ($main_Progress ,0xFF0000)

$size        = DirGetSize($server&"\"&$share&"\"&$directory&"\"&$source,1)

$search = FileFindFirstFile($server&"\"&$share&"\"&$directory&"\"&$source&"\*.*")

;MsgBox (0,"",$search)

If $search = -1 Then

    MsgBox(01600262144, "Error", "Installation Files Not Found"&@CRLF&"Please Contact Employee")

    Exit

EndIf

$b = 0

$i = $size[1]

DirCreate($destination)

While Not $i = 0

    $file = FileFindNextFile($search)

$i = $i - 1

$b = $b + 1

    FileCopy ($server&"\"&$share&"\"&$directory&"\"&$source&"\"&$file , $destination ,1 )

GUICtrlSetData ($Main_Progress ,$;)

Sleep (100)

If @error Then ExitLoop

;MsgBox (0,"",$i)

    ;MsgBox(4096, "File:", $file)

WEnd

<{POST_SNAPBACK}>

try updating your progress bar with this line instead... and let me know if it works.

ProgressSet(ound($b/$size[2]*100,0))

instead of the one that you have.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

try updating your progress bar with this line instead... and let me know if it works.

ProgressSet(Round($b/$size[2]*100,0))

instead of the one that you have.

<{POST_SNAPBACK}>


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

try updating your progress bar with this line instead... and let me know if it works.

ProgressSet(ound($b/$size[2]*100,0))

instead of the one that you have.

<{POST_SNAPBACK}>

No progress move at all ;)

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

If you are worried about someone closing the window since they do not see any activity, try putting an .avi on your GUI kind of like Microsoft has with the paper flying from one folder to another while copying. Also, you could have some text on your window which says, "Coping file: blah.exe".

Share this post


Link to post
Share on other sites

some files that will be copied is big 500 megs it will not be precise ;)

Why not get a command line file splitter for files over xMB and update the progress bar between each file segment? In other words, packetize your data stream...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

:mad2: Finaly i found the way to show progress with filecopy command but then :P i discovered that file copy command dose not keep the source directory structure ;) . Is there an easy way to rebuild source to destination dir structure ? By the way guys really isnt there some other way to monitor the progress ? i saw a post that says that it can be done with external programs like robocopy ? Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

Is there an easy way to rebuild source to destination dir structure ? By the way guys really isnt there some other way to monitor the progress ? i saw a post that says that it can be done with external programs like robocopy ?

<{POST_SNAPBACK}>

There is a way but it may not be easy.

The inbuilt windows file copy dialog box can be called from your code and perform operations like file move and file copy.

Unfortunately its not easy to implement this in AutoIt code and needs DllStruct and DllCall.

Here is the MSDN link for SHFileOperation API function: http://msdn.microsoft.com/library/default....leoperation.asp

And a VB tutorial for the same: http://vbnet.mvps.org/index.html?code/shel...rectorycopy.htm

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