strick
Posts: 14
Joined: Fri Jul 09, 2010 2:12 pm

DetectProcess

I need to detect if a process is running, and if it is, do not install. I looked through the help and still cannot get this to work.

Under InstallUISequence I have a Begin. I then add 'Predefined Custom Action' called 'DetectProcess'.

For 'Action Data' I typed in XRclient.exe.

When I save and build, Advanced Installer is still running the installer even though that process is running.

What else do I need to add?


Thank You!
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: DetectProcess

Hello,

The following guide informs on the usage of the DetectProcess predefined custom action:
http://www.advancedinstaller.com/user-g ... ocess.html

You will then need a custom action that returns one of the values documented by MSDN here:
http://msdn.microsoft.com/en-us/library ... S.85).aspx

This is how a custom action can terminate the install process. Return the appropriate value to receive the behaviors described there. Make sure you condition this custom action so it only runs if the process was detected.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
strick
Posts: 14
Joined: Fri Jul 09, 2010 2:12 pm

Re: DetectProcess

You will then need a custom action that returns one of the values documented by MSDN here:
http://msdn.microsoft.com/en-us/library ... S.85).aspx

Where do I put this custom action? I am not familiar with this and there is not much in the help docs.

Can you give me a step by step on what and where I have to enter this information in Advanced Installer?

Thanks!
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: DetectProcess

Hello,

You must place it both custom actions under InstallUISequence->Begin and InstallExecuteSequence->Begin. Use the resulting property of the DetectProcess custom action to condition the next custom action (the one returning the values listed on MSDN).

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
strick
Posts: 14
Joined: Fri Jul 09, 2010 2:12 pm

Re: DetectProcess

Use the resulting property of the DetectProcess custom action to condition the next custom action (the one returning the values listed on MSDN).

Where do I add this in Advanced Installer?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: DetectProcess

Hello,

Add under UI Custom Actions, then call it using DoAction right after the SetProperty published event you've created.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
strick
Posts: 14
Joined: Fri Jul 09, 2010 2:12 pm

Re: DetectProcess

Here is an email reply from tech support, which was very helpful.

Let me explain what you need to do:
-- first you will show the standard action Begin under InstallUISequence and InstallExecuteSequence in the "Custom Actions" page. Here is is explained how to do this:
http://www.advancedinstaller.com/user-g ... question38

-- now add the predefined custom action Detect Process and set the "Action Data" field to the exact name of your process, as you can see it with task manager
-- set the custom action condition to:

NOT Installed

-- now press [Shift] key and drag the custom action under the other Begin standard action; this will make the custom action to be shared between the two standard actions.

Now, to stop the installation if the process is running is very simple and you don't need to use another custom action. You can use our built-in support:

-- go to "Launch Conditions" page, "Custom Launch Conditions" tab http://www.advancedinstaller.com/user-g ... -user.html
http://www.advancedinstaller.com/user-g ... ialog.html

-- here create a new launch condition and set the condition to:

AI_PROCESS_STATE = "Stopped"

-- the Description field can be set to a mesage that you wish to the display to your users; for example: "Please close application XR in order to correctly install this package."

This should be enough to accomplish the desired actions in case the process you are searching for it is running.

Return to “Common Problems”