gary_baird
Posts: 5
Joined: Wed May 13, 2009 5:47 pm

Previous Version Needs to Uninstall and Reboot First

Previous Version Needs to Uninstall and Reboot First

My previous release of a particular driver had the option "Remove driver on uninstall" option set, but this has created a problem with the present as we need to uninstall the application prior to installing the latest version. I need to detect a previous install and display a prompt to uninstall the previous version and then restart the computer. I have looked at the help files and I am not seeing a clear description about how to span a dialogue and reboot a computer before continuing with the install.

Can anyone point me in the right direction and/or give me detailed instructions i.e. steps to do this?

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

Re: Previous Version Needs to Uninstall and Reboot First

Hello,

- on the Custom Actions page, under InstallUISequence, make the FindRelatedProducts standard action visible
- place a Script Inline custom action immediately after FindRelatedProducts
- set the custom action's Script Text to:

Code: Select all

Session.Property("RESULT") = CStr( MsgBox("Do you want to remove the previous version?",vbYesNo,"Previous version of this product detected") )
and the condition to:

Code: Select all

OLDPRODUCTS
This will prompt the user whether to uninstall the old version. The result of the user's choice is stored in the RESULT property. It will have the value "6" if Yes is selected, "7" if "No is selected
- add an "Uninstall Previous Versions" custom action right after the first two. Set the condition to:

Code: Select all

RESULT = 6
This will uninstall the previous versions. Make sure this custom action is set to synchronous.
- add another "Launch file or Open URL" custom action and set the Command Line field to:

Code: Select all

shutdown -r -t 0
and the condition to:

Code: Select all

RESULT = 6
this will restart the computer.

You will have to make sure that your installer starts again, since it will not start by default after the computer is restarted. To achieve this, write the SOURCEDIR property to the Run Key so your installer starts again after the restart. Delete the key when the install is finished.

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

Return to “Common Problems”