Search code examples
windowsinstallationinno-setuppascalscriptinno-download-plugin

Download and run sub install - Inno Download Plugin progress bar does not move during download


Ok, so I created the following iss but I the progress bar does not move. I want the setup file to download and run the other setup program. Everything works fine except the progress bar does not move.

#define MyAppName "My Program Setup Downloader"
#define MySetupAppName "My Program Setup.exe"
#define MySetupUrlFolder "https://www.example.com/folder/"
#pragma include __INCLUDE__ + ";" + "c:\Program Files (x86)\Inno Download Plugin\"

[Setup]

AppName={#MyAppName}
AppVerName={#MyAppName}
DisableReadyPage=yes
DisableFinishedPage=yes
CreateAppDir=no
Uninstallable=no

#include <idp.iss>

[Code]

var FileName: string;

procedure InitializeWizard;
var DownloadUrl: String;
begin
  FileName := ExpandConstant('{tmp}\{#MySetupAppName}');
  DownloadUrl := '{#MySetupUrlFolder}{#MySetupAppName}';
  idpAddFile(DownloadUrl, FileName);
  idpDownloadAfter(wpSelectDir);
end;

function NextButtonClick(CurPageID: Integer) : boolean;
var ResultCode: Integer;
begin
  if CurPageID = IDPForm.Page.ID then
  begin
    Result := Exec(FileName, '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
    if not Result then MsgBox('Error Running Downloaded Setup File', mbError, MB_OK);  
    Result := True;       
  end
    else Result := True;
end;

Any Ideas? Everything else works fine.


Edit: I have a workaround that will show the details section. This might be more appropriate anyways. Still not sure why the Total progress is not updating.

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = IDPForm.Page.ID then
  begin
    idpShowDetails(True);
    IDPForm.TotalProgressBar.Visible := false;
    IDPForm.TotalProgressLabel.Visible := false;
    IDPForm.TotalDownloaded.Visible := false;
    IDPForm.CurrentFileLabel.Caption := 'Downloading...';
    IDPForm.DetailsButton.Visible := False;
    WizardForm.NextButton.Visible := False;
    WizardForm.PageNameLabel.Caption := 'Downloading Setup File';
    WizardForm.PageDescriptionLabel.Caption := 'Please wait while the Setup file is being downloaded.';
  end;
end;

Solution

  • I indeed get the same behavior. I do not understand why.

    But as you have a single file, you can replace the total progress bar with file progress bar:

    procedure CurPageChanged(CurPageID: Integer);
    begin
      if CurPageID = IDPForm.Page.ID then
      begin
        IDPForm.TotalProgressBar.Visible := False;
        IDPForm.FileProgressBar.Top := IDPForm.TotalProgressBar.Top;
        IDPForm.FileProgressBar.Visible := True;
        IDPForm.DetailsButton.Visible := False;
    
        IDPForm.DetailsVisible := True;
      end;
    end;
    

    enter image description here