View Full Version : Help - Progress Percents
Can I add one more decimal in progress percents?
1.1% --> 1.13%
Like In Black Box v2
pakrat2k2
08-02-2015, 21:18
start reading here in this topic, few posts / pages, shows how it should be.
http://fileforums.com/showpost.php?p=419604&postcount=220
start reading here in this topic, few posts / pages, shows how it should be.
http://fileforums.com/showpost.php?p=419604&postcount=220
Please show me through this script
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword;
var
Remaining: Integer;
begin
if OveralPct<=Wizardform.ProgressGauge.Max then
Wizardform.Progressgauge.Position := OveralPct;
Result := ISDoneCancel;
with WizardForm.ProgressGauge do begin
WizardForm.Caption:='Installing - <<{#AppName}>>';
if OveralPct>0 then
begin
WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1);
end;
WizardForm.StatusLabel.Caption :='Unpacking Archives '+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80));
end;
end;
Razor12911
09-02-2015, 07:01
use this function
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
/////////////////////////////////////////////////Example/////////////////////////////////
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword;
var
Remaining: Integer;
begin
if OveralPct<=Wizardform.ProgressGauge.Max then
Wizardform.Progressgauge.Position := OveralPct;
Result := ISDoneCancel;
with WizardForm.ProgressGauge do begin
WizardForm.Caption:='Installing - <<{#AppName}>>';
if OveralPct>0 then
begin
WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1);
end;
if WizardForm.ProgressGauge.Max <> 0 then
WizardForm.StatusLabel.Caption :='Unpacking Archives ' + NumToStr((WizardForm.ProgressGauge.Position * 100) / WizardForm.ProgressGauge.Max) + '%';
WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80));
end;
end;
It gives whole number not two decimals
http://s28.postimg.org/jyg5tiwql/Untitled.jpg
Please show me through this script
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword;
var
Remaining: Integer;
begin
if OveralPct<=Wizardform.ProgressGauge.Max then
Wizardform.Progressgauge.Position := OveralPct;
Result := ISDoneCancel;
with WizardForm.ProgressGauge do begin
WizardForm.Caption:='Installing - <<{#AppName}>>';
if OveralPct>0 then
begin
WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1);
end;
WizardForm.StatusLabel.Caption :='Unpacking Archives '+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80));
end;
end;
In your script try to change
'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
To this
'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+''+chr(48 + OveralPct mod 5)+'%';
maybe this help you
This convert progress %age to
1.1% --> 1.11%
1.2% --> 1.22%
1.3% --> 1.33%
1.4% --> 1.44%
1.5% --> 1.50%
1.6% --> 1.61%
I like it somehow but i don't like repeating of two decimals.
I like this way in Black Box v2
It give
1.1% --> 1.13%
then
1.1% --> 1.17%
then goes to
1.2%
Can you do that???
Razor12911
12-02-2015, 15:01
did you try my example in ansi or unicode?
yes
It gives whole number not two decimals
http://s28.postimg.org/jyg5tiwql/Untitled.jpg
pakrat2k2
13-02-2015, 10:03
yes
what kind of answer is that ? He asked used ansi OR Unicode. Which did you try in ? if you tried both then say both, otherwise how is he to help ?
what kind of answer is that ? He asked used ansi OR Unicode. Which did you try in ? if you tried both then say both, otherwise how is he to help ?
Unicode
Razor12911
23-02-2015, 05:48
use this updated function
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
SetLength(Result, Length(Result)-1);
End;
/////////////////////////////////////////////////Example/////////////////////////////////
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAn siChar): longword;
var
Remaining: Integer;
x1, x2: extended;
begin
x1:=Wizardform.Progressgauge.Position;
x2:=Wizardform.Progressgauge.Max;
if OveralPct<=Wizardform.ProgressGauge.Max then
Wizardform.Progressgauge.Position := OveralPct;
Result := ISDoneCancel;
with WizardForm.ProgressGauge do begin
WizardForm.Caption:='Installing - <<{#AppName}>>';
if OveralPct>0 then
begin
WizardForm.Caption:='Installing - <<{#AppName}>>'+(' Wait:' + TimeStr1);
end;
if WizardForm.ProgressGauge.Max <> 0 then
WizardForm.StatusLabel.Caption :='Unpacking Archives ' + NumToStr((x1 * 100) / x2) + '%';
WizardForm.FilenameLabel.Caption :=' Extracting File: '+ MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.ProgressGauge.Width-ScaleX(80));
end;
end;
This gives
1.1% ---> 11%
means no decimal.
Tested in unicode.
Razor12911
26-02-2015, 16:45
lol, then there is something that I am not doing right. i used the same approach with the R.G. Mechenics script, will look through it.
y_thelastknight
26-02-2015, 21:46
i used another format for that now i forget that what i did.
let me check my source first.
i used another format for that now i forget that what i did.
let me check my source first.
Please hurry. Waiting!!!
Razor12911
13-03-2015, 04:12
bro, I used the same code for RG Mechenics script to make it show decimals and even blackbox, just check the UltraARC thread.
or just this
http://fileforums.com/showpost.php?p=438322&postcount=4
Razor12911
16-03-2015, 03:08
just remove anything that has to do with splitpct.
Razor12911
27-03-2015, 15:35
Maybe this will help
http://fileforums.com/showthread.php?t=96115
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.