How to set the value of the execution line in the [Run] section of the Inno Setup script installation?

This is similar to this question: Inno Setup A simple progress page for the Run section

If I add some MSI files to the Inno Setup script, I can install these files from the [Run] section. At this time, the progress bar shows 100% and shows StatusMsg above the progress bar.

I want to manually set the progress bar value in the [Run] section, say, a value of 50%.

Similarly, something like this:

 [Run] Filename: msiexec.exe; Parameters: "/i ""{#MyRtePath}\runtime.msi"" /qn /norestart"; \ StatusMsg: Installing Runtime Engine; WizardForm.ProgressGauge.progress: 50 ; 
+4
installer progress-bar inno-setup uninstaller
source share
2 answers

You can use similar code for a related question by calling it from the BeforeInstall and / or AfterInstall for each [Run] entry. Please note that Inno itself will work up to 100% in the file section, so you will need to start again at 0% or adjust EVERY record to use custom positioning.

+2
source share

Late answer, but here is an example of the code that I made for anyone looking for an answer.

Above the [Setup] section, you will need to define a constant named AppName for later use, you can also use it to set your AppName variable.

 #define AppName "Test Installer" [Setup] AppName={#AppName} 

Now in the [code] section you need to add the following.

 [Code] var InstallWithProgressPage : TOutputProgressWizardPage; //Create custom progress bar for install progress procedure InitializeWizard; var UpdatedPageString: AnsiString; OriginalPageString: String; begin //The string msgWizardPreparing has the macro '[name]' inside that we have to replace. OriginalPageString := SetupMessage(msgPreparingDesc); StringChange(OriginalPageString, '[name]', '{#AppName}'); UpdatedPageString := OriginalPageString; InstallWithProgressPage := CreateOutputProgressPage(SetupMessage(msgWizardPreparing), UpdatedPageString); end; //Enable or Disable the install progress page (also set initial progress/text) procedure DisplayInstallProgress(showPage:Boolean; progressText:String); begin if(showPage = True) then begin InstallWithProgressPage.Show; InstallWithProgressPage.SetText(progressText, ''); InstallWithProgressPage.SetProgress(0,100); end else begin InstallWithProgressPage.Hide; end end; //Update the install progress page procedure UpdateInstallProgress(progressText:String; progressPercent:Integer); begin InstallWithProgressPage.SetProgress(progressPercent,100); InstallWithProgressPage.SetText(progressText, ''); end; 

Now you can call the DisplayInstallProgress and UpdateInstallProgress procedures in the [Run] section using the BeforeInstall and AfterInstall parameters, as shown below.

 [Run] FileName: "Powershell.exe"; Parameters: "-File {app}\Part1.ps1"; BeforeInstall: DisplayInstallProgress(True, 'Installing part 1.'); FileName: "Powershell.exe"; Parameters: "-File {app}\Part2.ps1"; BeforeInstall: UpdateInstallProgress('Installing part 2.', 30); FileName: "Powershell.exe"; Parameters: "-File {app}\Part3.ps1"; BeforeInstall: UpdateInstallProgress('Installing part 3.', 60); FileName: "Powershell.exe"; Parameters: "-File {app}\Part3.ps1"; BeforeInstall: UpdateInstallProgress('Installing part 4.',90); AfterInstall: DisplayInstallProgress(False, ''); 

I used this question / answer as a template to create a progress page: How do I show progress during "PrepareToInstall"?

Final note: this implementation goes against jrsoftware advice :

Always place the Hide call inside the final part of the try..finally construct, as shown in CodeDlg.iss. Not invoking Hide will cause the wizard to constantly get stuck on the progress page.

However, I could not understand how to implement progress on the elements in the [Run] section without doing this.

+1
source share

All Articles