ddag1
Posts: 7
Joined: Sun Jan 03, 2021 2:00 pm

Relaunch installer after exit dialog

Sun Jan 03, 2021 2:05 pm

Hi,
I need an option to relaunch my installer after pressing "Finish" on exit dialog. Is it possible to do so? Maybe with a checkbox?
Thank you so much in advance!

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Relaunch installer after exit dialog

Tue Jan 05, 2021 10:46 pm

Hello,

In theory, this should be possible, yes.

However, could you please let me know why you would need to do that?

If you will try to launch the same installer on a machine where it is already installed, you will be prompted with the following error:
Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Programs and Features in the Control Panel.
With that being said, nothing will happen anyway, even if you were to launch it.

For a step-by-step on how to launch a custom file after installation, please have a look over the following thread:

Re: Launch custom file after install

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ddag1
Posts: 7
Joined: Sun Jan 03, 2021 2:00 pm

Re: Relaunch installer after exit dialog

Wed Jan 06, 2021 8:25 am

Catalin wrote:
Tue Jan 05, 2021 10:46 pm
However, could you please let me know why you would need to do that?

If you will try to launch the same installer on a machine where it is already installed, you will be prompted with the following error:
Hello,

The installer (A) I'm developing with AI customizes another app (B) I developed before. It only extract files, it's not an app.
The thing is I need to re-run it multiple times, to choose different options (radio buttons) to be extracted in B.
So, launching the same installer is not an issue since actually is not "installing" but just extracting files, no Windows registry is being written.

Could you please explain me how to properly set a checkbox or pushbutton to relaunch the same installer (A) in ExitDialog?
Because in that guide I saw the example is notepad.exe which is a system app, so it is indeed possible to execute it, but how do I do that with my app?

Thank you so much!

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Relaunch installer after exit dialog

Thu Jan 07, 2021 4:25 pm

Hello,
Could you please explain me how to properly set a checkbox or pushbutton to relaunch the same installer (A) in ExitDialog?
Because in that guide I saw the example is notepad.exe which is a system app, so it is indeed possible to execute it, but how do I do that with my app?
Sure thing!

First of all, let's talk about the steps required to achieve this:

- we will need to store the path of the MSI/EXE somewhere. I'd say the best place to do so is in the registries.

- we will then need a custom action that will read the path from the registry and then launch our MSI/EXE one more time.

OBS: As I have mentioned earlier, this might not work due to the fact that the software is already installed on the machine. This way, the setup will be launched in Maintenance mode.

Toi avoid this, you can go to "Product Details" page and uncheck the "Register product with Windows Installer" option.

However, if this option is not checked you cannot remove, repair or reinstall the application by using the Control Panel, the Windows Installer command-line options or the Windows Installer application programming interface (API).

Here would be the steps to help you achieve what you need:

1. please go to "Registry" page and create a new value, as it follows:
registry.png
registry.png (39.18KiB)Viewed 2275 times
2. in "Custom Actions" page, create a custom action without sequence that retrieves the value of the registry (the path of the MSI) and then launches the MSI.

A PowerShell script that does this may look as it follows:

Code: Select all

$path = Get-ItemPropertyValue -path 'HKLM:\Software\Your Company\zzz' -name SourceOfMsi

Start-Process msiexec.exe -ArgumentList "/i $path"
3. schedule the custom action as a "Published Event" on the "Finish" button of the "ExitDlg" dialog
publishedevent.png
publishedevent.png (222.6KiB)Viewed 2275 times

Important: One really important thing we have to consider here is the registry redirection. The above custom action is indended to work in the following scenario:

- 32-bit setup installed on a 64-bit machine

As you may already know, 32-bit programs will redirect, on a 64-bit machine, the registry and the files to special locations:

- in case of files, that would be the "Program Files (x86)" folder

- in case of registry, that would be the "WOW6432Node"

wow6432node.png
wow6432node.png (95.97KiB)Viewed 2275 times

With that being said, depending on your scenario, you might need to have two custom actions. Depending on how you configure the custom action (PowerShell), you can choose to launch the 32-bit or the 64-bit PowerShell platform.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”