PDA

View Full Version : Progress Bar Problem


Maxim
03-15-2007, 04:58 AM
Hi,
I need some help with progress bar problem

This coding I attach is the current coding that I used.
And I think it's not effective..
I have to call
"DlgProgressBar.Step(CTRL_PROGRESS_BAR_01)
File.Copy(_SourceDrive.."\\test\\ab.exe", myfolder.."\\test",true, true, false, true, nil);"
everytime for each kind of files i want to copy..
i do need some assistant on this uneffectiveness..

Code:
myfolder = SessionVar.Expand("%AppFolder%");
DlgProgressBar.SetRange(CTRL_PROGRESS_BAR_01, 0, 26);
DlgProgressBar.SetStep(CTRL_PROGRESS_BAR_01, 1);
Folder.Create(myfolder.."\\test");
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\ab.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\ac.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\\ad.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\ae.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\af.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\ag.exe", myfolder.."\\Resource", true, true, false, true, nil);
DlgProgressBar.Step(CTRL_PROGRESS_BAR_01);
File.Copy(_SourceDrive.."\\test\\ah.exe", myfolder.."\\Resource", true, true, false, true, nil);

JXBURNS
03-15-2007, 06:31 AM
a) If the files you are copying are not already on the machine then you really should be using the Archive or Extract tabs, or if in a zip file the ZIP.EXTRACT command. I'm saying this for the benefit of others and looking at your code I see you appear to be copying from one folder to another.

b) I think you need to look at the CALLBACK function which you are not using at the moment by fact you have nil as the last parameter. From that the system returns the name of the file being copied and how far through it has got (returning bytes copied and total file bytes) from which you can update the progress bar as a percentage. Other values are also returned depending upon the function being used.

Whilst the File.Copy does not have an example of the CALLBACK function (which really it should have), do a search in the Help File for Callback Function Examples. A similar process will work for File.Copy so for every file you can show how far it has copied.

John