Jump to content

Recommended Posts

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 !

Posted

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:


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

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 !

Posted

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

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 !

Posted

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

Posted

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

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 !

Posted

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.

Posted

#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 !

Posted

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

Posted

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 !

Posted

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

Posted

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

Posted

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

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