don_ucw
Posts: 18
Joined: Tue Nov 20, 2018 5:30 am

Execute custom action on install and uninstall only for specific feature

Fri Dec 14, 2018 4:22 am

I would like to execute a custom action on install only if a specific feature is installed. I saw this posting, however I need o run the action elevated and after the application is installed.

viewtopic.php?t=34512

I would also like to run a custom action elevated on uninstall, *only* if they had the feature installed.

Suggestions?


thanks

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

Re: Execute custom action on install and uninstall only for specific feature

Fri Dec 14, 2018 10:43 am

Hello Don,

Indeed, the condition that my colleague Sorin specified:

Code: Select all

((&Feature = 3) AND NOT (!Feature = 3))
can be translated to the following: Feature will be installed locally and Feature is not already installed on the machine.

In what regards the elevated custom action, you can use, for example, our predefined "LaunchFile" custom action which will have the "Run as administrator" flag checked. If you need to execute it after the application is installed, you can simply add it after "Add resources" action group ("Custom Actions" page). Also, if you want your custom action to be executed only on "Install", simply uncheck the "Uninstall" and "Maintenance" options from under "Execution Stage Condition".
I would also like to run a custom action elevated on uninstall, *only* if they had the feature installed.
In what regards this, you can simply add your custom action before the "Remove Resources" action group, check the "Run as Administrator" flag, uncheck the "Install" and "Maintenance" options from under the "Execution Stage Condition" and, in the "Condition:" field, you can use a condition as it follows:

Code: Select all

((&Feature = 2) AND (!Feature = 3))
which can be translated as it follows: Feature will be uninstalled and Feature is already installed on the machine.

Hope this helps.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

don_ucw
Posts: 18
Joined: Tue Nov 20, 2018 5:30 am

Re: Execute custom action on install and uninstall only for specific feature

Fri Dec 14, 2018 3:32 pm

Thanks Catalin,

is there a help page that can tell me what the special numbers '2' and '3' mean (that are used in the conditions)?

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

Re: Execute custom action on install and uninstall only for specific feature

Fri Dec 14, 2018 4:13 pm

You are always welcome, Don.
is there a help page that can tell me what the special numbers '2' and '3' mean (that are used in the conditions)?
Yes, for more information about this, you can have a look on our "Edit Condition Dialog" article.

All the best,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”