oleg Posted September 14, 2005 Posted September 14, 2005 (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 September 14, 2005 by oleg There is a hex ( 31303030303030 ) reasons i love AutoIt !
Josbe Posted September 14, 2005 Posted September 14, 2005 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}>Search resultsBTW, If you don't know how to use Search feature, simply start learning. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
BigDod Posted September 14, 2005 Posted September 14, 2005 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 threadAll I searched for was "progress bar" and look at what I found. 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
oleg Posted September 14, 2005 Author Posted September 14, 2005 Will check it out thanks guys There is a hex ( 31303030303030 ) reasons i love AutoIt !
oleg Posted September 14, 2005 Author Posted September 14, 2005 (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 September 14, 2005 by oleg There is a hex ( 31303030303030 ) reasons i love AutoIt !
seandisanti Posted September 14, 2005 Posted September 14, 2005 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.
oleg Posted September 14, 2005 Author Posted September 14, 2005 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 !
seandisanti Posted September 14, 2005 Posted September 14, 2005 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.
oleg Posted September 14, 2005 Author Posted September 14, 2005 (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 September 14, 2005 by oleg There is a hex ( 31303030303030 ) reasons i love AutoIt !
seandisanti Posted September 14, 2005 Posted September 14, 2005 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.
oleg Posted September 14, 2005 Author Posted September 14, 2005 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 so the user might think that the process stuck and closes the window . The other way uses explorer progress bar i cant use it To bad im out of There is a hex ( 31303030303030 ) reasons i love AutoIt !
seandisanti Posted September 14, 2005 Posted September 14, 2005 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 so the user might think that the process stuck and closes the window .The other way uses explorer progress bar i cant use it To bad im out of <{POST_SNAPBACK}>hm... if you post your code, i can just add the stuff you need.
oleg Posted September 14, 2005 Author Posted September 14, 2005 #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 !
seandisanti Posted September 14, 2005 Posted September 14, 2005 #include <GUIConstants.au3>Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt("Trayautopause" ,0);Opt ("Trayiconhide" ,1 );dim $titleIf $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") ExitEndIf$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.
seandisanti Posted September 14, 2005 Posted September 14, 2005 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}>
oleg Posted September 14, 2005 Author Posted September 14, 2005 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 !
AutoChris Posted September 14, 2005 Posted September 14, 2005 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".
jefhal Posted September 14, 2005 Posted September 14, 2005 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
oleg Posted September 15, 2005 Author Posted September 15, 2005 (edited) Finaly i found the way to show progress with filecopy command but then 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 September 15, 2005 by oleg There is a hex ( 31303030303030 ) reasons i love AutoIt !
tonedeaf Posted September 15, 2005 Posted September 15, 2005 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.aspAnd a VB tutorial for the same: http://vbnet.mvps.org/index.html?code/shel...rectorycopy.htm
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now