olegsavelos
Posts: 8
Joined: Mon May 13, 2013 9:40 am

Disallow install / repair / uninstall when running

Is it possible to disallow any installer actions if installed application is currently running?
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Disallow install / repair / uninstall when running

Hello,

In order to achieve that, you need a launch condition that whenever the process is running will stop the installation and inform the user.

You can detect if a process is running by using a "DetectProcess" predefined custom action. You can add this custom action
in the "Wizard DIalogs Stage" after the "Searches" action group. Please note that this custom action will set
the public property : "AI_RUNNING_STATE" with the two possible values:
Running - the process is running
Stopped - the process is stopped

You will further use this property "AI_PROCESS_STATE" in a launch condition. For that go to the "Launch Conditions" page and
in the "Custom" tab add a new Launch Condition. In the "Condition" field you will have AI_PROCESS_STATE <> "Running" .
In the "Description" field write a useful message for the user.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
olegsavelos
Posts: 8
Joined: Mon May 13, 2013 9:40 am

Re: Disallow install / repair / uninstall when running

Ok this worked for installation but does not work for uninstall or repair.
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: Disallow install / repair / uninstall when running

Hello,

You can create a "Display error message " after the “DetectProcess” custom action and alert the user that the application is currently running.
In the “Condition” field of the error message custom action's properties you can set:

Code: Select all

AI_PROCESS_STATE = "Running"
Also, you can select just the “Uninstall” and “Maintenance” options from the “Dialogs Stage Condition” of the added custom action.

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HasNoName
Posts: 5
Joined: Fri Aug 16, 2013 1:17 am

Re: Disallow install / repair / uninstall when running

It works, but the user can uninstall per context menu.
Install and Maintenance will be locked if a process is detected.

My steps:
Custom Actions

DetectProcess -> Process name = File.ext (moved below "Searches")

ErrorMessage -> Message = Your Text, Dialog Stage Condition: Condition = AI_PROCESS_STATE = "Running" (moved below "Paths Resolution") and it works.

I use this in the Dialogs instead of "Display error message" ;)
_

Return to “Building Installers”