Custom action not to run during repair - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Custom action not to run during repair

Hi,

I am experimenting with a xcopy script that backups contents of a whole directory that I only want to run under certain conditions. These conditions are below , should not be run if it is an uninstall and it must be installed to run or a specific folder must be present for it to run and not in the process of uninstalling:
(NOT REMOVE="ALL") AND Installed OR (RESULT_FOLDER AND (NOT REMOVE="ALL"))

In addition to the above conditions I don't want the script to run when entering repair mode. How can I accomplish this?
Thanks!

Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

Hi Christian,

The condition to detect a Modify/Repair is:

Code: Select all

Installed AND (NOT REMOVE)
I am afraid there is no way to distinguish between a Modify and a Repair.

However, since a Modify requires a UI in which to select which features to install/reinstall/uninstall etc, you can set a property, let's say THIS_IS_MODIFY on the Modify button in MaintenanceTypeDlg. You can then use that property to decide whether you're running in repair mode or modify mode.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Re: Custom action not to run during repair

Hi Gabriel,

Thanks for you quick reply.

Unfortunately I need to run it with basic user interface and no user interaction with dialogs. I dont think I need to distinguish between Modify and Repair or do I?

I tried this but it still runs the xcopy script, while doing a repair:
(NOT REMOVE="ALL") AND Installed OR (RESULT_FOLDER AND (NOT REMOVE="ALL")) OR Installed AND (NOT REMOVE)

Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

Hi Christian,

The condition I posted identifies a repair/modify.
If you want it to not run during a repair/modify, simply negate the condition like this:

Code: Select all

NOT (Installed AND (NOT REMOVE))
Let me know if that worked.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Re: Custom action not to run during repair

Hi Gabriel,

I tried this:
(NOT REMOVE="ALL") AND Installed OR (RESULT_FOLDER AND (NOT REMOVE="ALL")) OR NOT (Installed AND (NOT REMOVE))

It still runs the xcopy script during a repair action via an advertised shortcut?

Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

Hi Christian,

I believe my condition is enough, you don't need the rest of the condition you specified.
Simply try:

Code: Select all

NOT (Installed AND (NOT REMOVE))
Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Re: Custom action not to run during repair

Hi Gabriel,

Thanks for your response. Your solution works as standalone, the problem is that it doesn't work with the other conditions I need to have. The conditions I need to have is

That the script shall only run if:
  • There is a previous installation or;
    There is a specific folder present;
It should not run:
  • During a repair or;
    When an uninstall is performed or;
    No specific folder present or;
    No previous installation
Hope you can help me with this :)

Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

Hi Christian,

What I understood was:
You want the custom action to run either when the user clicks Modify or during a first install, if that specific folder is found. In no other circumstances should the custom action run.
The condition for this is:

Code: Select all

IS_MODIFY OR (RESULT_FOLDER AND (NOT Installed) )
IS_MODIFY is a property you set using a SetProperty event on the Modify button in MaintenanceTypeDlg

Let me know if this is what you wanted.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Re: Custom action not to run during repair

Hi Gabriel,

Sorry if I have been unclear. What I wan't is this:

The installer runs with no interaction from user, basic UI (except the possiblity to cancel the install) at install. So there is no user interaction with any dialogs during install, after install an advertised shortcut can be used by a another application (Myapp, repair button) to activate a repair if required. So when the installer is run I want the custom action (Backup script) to run only if there is a previous install or a specific folder otherwise I will get a xcopy error.
I dont want the custom action (backup script) to run if a uninstall is being done or if a repair is activated (by myapplication via a repair button).
So basically what I want to happen is that before any install is made of my app a backup is done of the previous version of my app, but it need to check that there is a previous install or a map with myapp otherwise I get a Xcopy error. This is done because i have made a RollBack functionality from my application (Restore of previous version of my app).
But I don't want the custom action (backup script) to run when a repair is called by the application, because what happens then is that it backsup the latest version over the previous version and then there is no idea to use the rollback feature of myapp.
The same is valid for an uninstall, the custom action (backup script) should not run then either.
Thanks for your assistance.

Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

Hi Christian,

The following condition should do it I hope:

Code: Select all

(OLDPRODUCTS AND NOT (Installed and NOT REMOVE))  OR  (RESULT_PROPERTY AND NOT Installed)
Let me know how it worked.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cfs80
Posts: 27
Joined: Tue Mar 30, 2010 9:10 am

Re: Custom action not to run during repair

Hi Gabriel,

You are da Man! That solved it perfectly :) . Thanks for excellent support.
Have a nice weekend!
Brgds
Christian
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Custom action not to run during repair

You're welcome :)

Have a nice weekend too!

Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”