0

How to show percent done, elapsed time and estimated time progress at .arc decompression? I am trying to use part of this code How to add .arc decompression to Inno Setup? (percent) to add this to Inno Setup - How to add multiple arc files to decompress?

I am trying to use code of ISDone to my script. The ISDone code uses the function:

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
  if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
end;

And this to define the location of the labels:

procedure CreateControls;
begin
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := PBTop + ScaleY(35);
  end;
  LabelTime2 := TLabel.Create(WizardForm);
  with LabelTime2 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := LabelTime1.Width+ScaleX(40);
    Left     := ISDoneProgressBar1.Width div 2;
    Top      := LabelTime1.Top;
  end;
  LabelTime3 := TLabel.Create(WizardForm);
  with LabelTime3 do begin
    Parent   := WizardForm.FinishedPage;
    AutoSize := False;
    Width    := 300;
    Left     := 180;
    Top      := 200;
  end;
end;

This code is part of code of ISDone 0.6.

Community
  • 1
  • 1
Nico Z
  • 997
  • 10
  • 33
  • What did you try? – Martin Prikryl Mar 31 '17 at 13:42
  • @MartinPrikryl I am trying to use the code of ISDone 0.6 and IsFreeArcExtract. – Nico Z Mar 31 '17 at 22:47
  • Looks good. Any problem with that? - Also note the `ProgressPage.SetText(Format('Extracted: %d%%', [Percent]), '');` in http://stackoverflow.com/a/42752166/850848 – Martin Prikryl Apr 01 '17 at 05:07
  • Though you better start here: [How to show percent done, elapsed time and estimated time progress?](http://stackoverflow.com/q/20092779/850848) - But I assume you know that, as you have used identical question title. – Martin Prikryl Apr 01 '17 at 05:24
  • @MartinPrikryl Thanks for the info Martin. I am trying, but still no luck, my code does not work at the moment. – Nico Z Apr 12 '17 at 14:14
  • As many times before: *"does not work"* is totally useless comment. No point even posting it. Show us the code! Describe what's not working! – Martin Prikryl Apr 12 '17 at 14:17
  • 1
    @MartinPrikryl Sorry Martin, i want to show a decent code and that's what takes me time. Very complicated for me. – Nico Z Apr 24 '17 at 22:16

1 Answers1

0

I am assuming that you need freearc extraction along with the ISDone's time label features? If so you dont have to use both the ISDone code and ISFreeArcExtract code together because ISDone has Freearc extraction implemented. You can use ISArcExract function for unpacking .arc files. Here's the function definition

function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';

And here's how you use it. The below code can be found in the CurStepChanged procedure of the script. You can add multiple lines with multiple arc files and PctOfTotal to denote the percentage a particular arc file will consume in a overall installation of 100%.

if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data.arc'), ExpandConstant('{app}\'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

Here data.arc will be extracted as a freearc archive and will consume 10% of the installation.

Please note that the above section's are taken from ISDone 0.6

Sam
  • 128
  • 1
  • 5