AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Progress Bar - new feature..

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
jpkishere
Guest





PostPosted: Mon Jun 28, 2004 6:32 pm    Post subject: Progress Bar - new feature.. Reply with quote

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





PostPosted: Mon Jun 28, 2004 8:50 pm    Post subject: Just to let you.. Reply with quote

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

PostPosted: Mon Jun 28, 2004 10:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Mon Jun 28, 2004 10:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10465

PostPosted: Mon Jun 28, 2004 11:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jpkishere
Guest





PostPosted: Tue Jun 29, 2004 1:05 pm    Post subject: That works, but... Reply with quote

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

PostPosted: Tue Jun 29, 2004 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group