If I have a table containing several files, I am copying them to another location. How can I code a Time Left for the user?
such as xx:xx Time Remaining.
Thanks
Professional Software Development Tools
If I have a table containing several files, I am copying them to another location. How can I code a Time Left for the user?
such as xx:xx Time Remaining.
Thanks
You'd have to use a callback function and use a global variable and calculate time left based on copy rate...
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
You'd have to use a callback function and use a global variable and calculate time left based on copy rate...
I have the callback function and a Global variable would be easy but how do you figure out Copy rate.
Global Variable1 is the (Total Files)
Global Variable2 is the(Current File)
Dividing Variable 2 into 1 gives the 50%
Dividing Variable 1 into 2 gives 2
Now How can I make this work?
You need to use know the time elapsed; then calculate the time elapsed vs bytes copied -- use that as a percentage of total bytes, then calculate out bytes remaining.. at 1st the estimated time will be off and change rapidly; but it should soon settle down to a only slightly varying estimation...
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
Global Variable1 is the (Total Bytes)
Global Variable2 is the(Bytes Copied so far)
Variable (Start Time)
Variable (End Time)
Elapsed (Start Time - End Time)
Variable2 is Percent of Varible1
Subtract (Variable2 from 1)
Im thinking that will be expressed as a percent but not as SS:MM?
My functions are;
My Calls are:Code:function COPYCB(Source,Destination,Copied,Total) DlgProgressBar.SetPos(CTRL_PROGRESS_BAR_02, (nfl / nflcnt) * 100); BytesCSF = BytesCSF + Copied E_Time = System.GetTime(TIME_FMT_MIN)..":"..System.GetTime(TIME_FMT_SEC) End_Time = Time2Num(E_Time) Elapsed = End_Time - Start_Time TEvsBC = Elapsed / BytesCSF Current_Percent = TEvsBC / TBytes Display_TL = Math.Round(Current_Percent,0) Display_TL = Time2Str(Display_TL) --Dialog.TimedMessage("Please Wait...", End_Time.." "..Start_Time.." "..Elapsed.." "..BytesCSF.." "..TBytes.."\r\n", 500, MB_ICONINFORMATION); return true; --continue copying end function Time2Num(Tme) Raw_Min = String.ToNumber(String.Left(Tme, 2)); Raw_Sec = String.ToNumber(String.Mid(Tme, 4, 2)); Num_Time = (Raw_Min * 59) + Raw_Sec Tme = Num_Time return Tme end function Time2Str(Tme) Str_Min = Math.Round((Tme /59), 0); Str_Sec = Math.Mod(Tme, 59) Num_Time = Str_Min..":"..Str_Sec Tme = Num_Time return Tme end function gtbs(Path) local nSize = File.GetSize(Path); TBytes = g_FolderSize + nSize; return true; end
Code:TBytes = 0 BytesCSF = 0 Start_T = System.GetTime(TIME_FMT_MIN)..":"..System.GetTime(TIME_FMT_SEC) Start_Time = Time2Num(Start_T)My "Time Left" seems to get larger and larger. I think I may be missing a step somewhereCode:File.Copy(tfiles[n], Sdest..dest, true, true, true, true, COPYCB);