FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   Help - Progress Percents (https://fileforums.com/showthread.php?t=96645)

Bilawal 08-02-2015 19:53

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...&postcount=220

Bilawal 09-02-2015 00:12

Quote:

Originally Posted by pakrat2k2 (Post 437860)
start reading here in this topic, few posts / pages, shows how it should be.

http://fileforums.com/showpost.php?p...&postcount=220

Please show me through this script
Quote:

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;

Bilawal 09-02-2015 19:45

It gives whole number not two decimals
http://s28.postimg.org/jyg5tiwql/Untitled.jpg

gozarck 10-02-2015 12:08

Quote:

Originally Posted by Bilawal (Post 437862)
Please show me through this script

Quote:

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


Code:

'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
To this

Code:

'+IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+''+chr(48 + OveralPct mod 5)+'%';


maybe this help you

Bilawal 10-02-2015 18:26

This convert progress %age to

Quote:

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

Quote:

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?

Bilawal 12-02-2015 21:51

yes
Quote:

Originally Posted by Bilawal (Post 437916)
It gives whole number not two decimals
http://s28.postimg.org/jyg5tiwql/Untitled.jpg


pakrat2k2 13-02-2015 10:03

Quote:

Originally Posted by Bilawal (Post 438040)
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 ?

Bilawal 14-02-2015 05:49

Quote:

Originally Posted by pakrat2k2 (Post 438051)
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;

Bilawal 25-02-2015 18:09

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.


All times are GMT -7. The time now is 03:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com