| View previous topic :: View next topic |
| Author |
Message |
jpkishere Guest
|
Posted: Mon Jun 28, 2004 6:32 pm Post subject: Progress Bar - new feature.. |
|
|
Would love to see if you could have the progess bar continually just run without pausing at all.. Sometimes I have scripts that run for unknown amount of time.. Just having a bar that constantly loops while a process is running makes users think something is happening..
tia
jpkishere |
|
| Back to top |
|
 |
jpkishere Guest
|
Posted: Mon Jun 28, 2004 8:50 pm Post subject: Just to let you.. |
|
|
| know where I am coming from.. I am using the FileCopyDir function to copy over a 100mb directory.. So that takes a few minutes and I have no way of letting the user now what is in progress.. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Mon Jun 28, 2004 10:18 pm Post subject: |
|
|
I'm sure if you got tricky with it you could setup two Progress Bar's one that shows the current process and one that just constantly moves. The one that shows the progress could do a FileGetSize, then as it copies the files over have a Timer setup to see which files have arived in the new folder and do a FileGetSize on them and subtract that total from the original size.
thanks,
beardboy |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Mon Jun 28, 2004 10:59 pm Post subject: |
|
|
Scratch my last comment, the FileCopyDir doesn't allow Timers to run until it completes. Here is an example script using %comspec%. Change the folder names, files, and the progress bar settings and you should be good to go:
| Code: | pthick = 7 ; Set Progress Thickness
pwidth = 75 ; Set Progress Width
progress = 0
Progress, b w%pwidth% x1 y1 zb%pthick% zx0 zy0
Progress, 2:b w%pwidth% x1 y10 zb%pthick% zx0 zy0 zcFF0000
Loop, c:\jackass\*.*
{
totalsize += %A_LoopFileSizeMB%
}
SetTimer, Filecheck, 200
Loop, c:\Jackass\*.*
{
RunWait, %comspec% /c xcopy "%A_LoopFileFullPath%" c:\Jackass2\ /d /y,,hide
}
MsgBox, Done
Exit
Filecheck:
currentsize = 0.00
Progress, %progress%
Loop, c:\jackass2\*.*
{
currentsize += %A_LoopFileSizeMB%
}
currentsize /= %totalsize%
currentsize *= 100
Progress, 2:%currentsize%
progress += 10
if progress = 100
progress = 0
return |
thanks,
beardboy |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Mon Jun 28, 2004 11:39 pm Post subject: |
|
|
Nice example. If desired, you can make each loop such as the below recursively include the contents of all subfolders as well:
Loop, c:\jackass\*.*, , 1 ; Adding the 1 makes it dig into subfolders too.
Also, file loops can be quite slow if there are hundreds or even thousands of files. So it's a good idea to increase BatchLines if that applies:
SetBatchLines, 10ms ; Make the operation faster. |
|
| Back to top |
|
 |
jpkishere Guest
|
Posted: Tue Jun 29, 2004 1:05 pm Post subject: That works, but... |
|
|
Thanks!
That seems to work well, with the exception of that I need to recreate the directory structure as well.. That is why the directory copy worked so well..
where this script runs, there are many nested directories..
Also, don't want to use xcopy but I am guessing I could you the FileCopy function that is available?
any other suggestions? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10465
|
Posted: Tue Jun 29, 2004 2:27 pm Post subject: |
|
|
If you specify the right options with xcopy, it should recreate the directory structure. Type xcopy /? at the command prompt to see all the options.
If there are other reasons you don't want to use xcopy, you could copy all the files and subdirectories individually by using a file loop. It might get a little complicated, but there is an example in the help file that could probably be enhanced to do this:
http://www.autohotkey.com/docs/commands/LoopFile.htm |
|
| Back to top |
|
 |
|