View previous topic :: View next topic |
Author |
Message |
kenmcn816 Newbie
Joined: 26 Mar 2003 Posts: 6
|
Posted: Fri Mar 28, 2003 7:11 pm Post subject: Creating Progress Bar for Single Large File |
|
|
Is there a way to create a progress bar for a single large file (around 800 MB) to be copied from a network drive to a local hard drive. I want to mirror the Windows File Copy dialog box that I want it to show the progress of the file being copied and an estimation of time. I have been told I can't accomplish this under VDS using the FILE copy command, because the next line won't be processed until the file copy operation is completed. I have been told I would have to use a Windows API call to accomplish what I'm after. Is there an easy way to do this? Any help anyone could give me would be great, thanks. |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
|
Back to top |
|
|
kenmcn816 Newbie
Joined: 26 Mar 2003 Posts: 6
|
Posted: Fri Mar 28, 2003 10:00 pm Post subject: |
|
|
I read the code that was contained in the previous message, however I still have a few questions. I understand that the loop will repeat until the progress reaches 100% and then go back to the :Evloop where it will wait for user input. The question I have is would the FILE Copy command allow the loop to continue or would the loop stop processing until the copy command was completed? Would you have to make the FILE Copy command the event in which to create the loop? This would create almost a nested loop in which the copy command was inside the progress bar loop. I don't know if this is feasible or not that is why I thought a Windows API call would need to be used in order to accomplish this. |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 28, 2003 11:54 pm Post subject: |
|
|
VDS doesn't multi-thread - once it starts a file copy it stays on
that line until finished.
The alternative is another EXE to monitor it, or another FILE COPY
routine (such as DOS copy, or a VDS prog that only copies) that ya
can call, then monitor from your original VDS prog (this would be my
choice - I like PGWARE's idea as well).
About the loop - you need a finished file size to check for, and when
the destination file reaches that size, it's done.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
|
Back to top |
|
|
iMPA Newbie
Joined: 26 May 2001 Posts: 9 Location: Spain
|
Posted: Sat Mar 29, 2003 12:06 pm Post subject: |
|
|
Hi kenmcn816!
this is an example of copying files using binfile and @binfile... it a little slow nor it works...
the code makes a copy of vdsrun40.dll from your windows\system directory to the script folder
hope that helps...
Code: |
title file copy progress bar
DIALOG CREATE,copy progress bar,-1,0,240,55
DIALOG ADD,PROGRESS,PROGRESS,5,5,230,24,0
DIALOG ADD,STATUS,STATUS
DIALOG SHOW
%%filein = @windir(s)\vdsrun40.dll
%%fileout = @path(%0)\vdsrun40.dll.bak
rem open de origin file
binfile open,1,%%filein,read
rem open the destination file
binfile open,2,%%fileout,create
rem seek the read position to zero
%%pos = 0
rem set a read offset value
rem please test different values for different speeds...
%%inc = 1024
rem start the copy routine
while @not(@binfile(eof,1))
rem read from file
binfile seek,1,%%pos
%%data = @binfile(read,1,hex,%%inc)
rem write to file
binfile write,2,hex,%%data
rem seek to another position
%%pos = @sum(%%pos,%%inc)
rem calculates the percentage
%p = @fmul(@fdiv(%%pos,@binfile(size,1)),100)
dialog set,progress,@format(%p,3.0)
dialog set,status,%p %
wend
rem close both files...
binfile close,1
binfile close,2
info operation completed !!
|
sorry for my poor english _________________ share what you know, learn what you don't |
|
Back to top |
|
|
ACE Valued Newbie
Joined: 05 Sep 2002 Posts: 34
|
Posted: Sat Mar 29, 2003 9:32 pm Post subject: |
|
|
sorry but the monitoring idea was mine
Lioric |
|
Back to top |
|
|
Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sun Mar 30, 2003 12:49 am Post subject: |
|
|
ACE wrote: | sorry but the monitoring idea was mine
Lioric |
ACE, not sure who you're addressing that remark to - but if
you check the link I posted, it monitors the DOS file copy
routine and is dated 07-24-2001.
I mentioned PGWARE's idea because he suggested re-calling
the same EXE with parameters, which saves the need for an
additional EXE.
I don't think anyone is trying to take credit for your ideas.
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|
Back to top |
|
|
kenmcn816 Newbie
Joined: 26 Mar 2003 Posts: 6
|
Posted: Mon Mar 31, 2003 9:09 pm Post subject: |
|
|
I wanted to thank everyone who responded. I have alot of good ideas to get started on making this work. Mac I really like your idea using the DOS copy command, and I will start there. I don't think there should be an issue even though we are using Windows XP, because the drive we will be copying to is a FAT32 drive. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|