neverhett
Posts: 6
Joined: Tue Mar 05, 2013 10:46 pm

Uninstalling previously installed software on target system

I've got a custom LaunchFileOrURL action that is executing at the end of my installer process during the "Finish Dialogs Stage". It is invoking an existing uninst.exe in a specified directory on the target computer (existing from a previous iteration of the software). I'd like to be able to only execute this if the referenced directory exists. Furthermore, I'd like to give the user a dialog box or popup to confirm whether they indeed want to execute this uninst.exe on their machine before proceeding. I found some information after browsing the help pages on: http://www.advancedinstaller.com/user-g ... l-msi.html, where it references one of the things I mentioned above (the user prompt), but I'm not sure how to implement this.

Any help with either or both of these features would be greatly appreciated!! Thanks!
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling previously installed software on target sys

Hi and welcome to Advanced Installer forums.

Thank you for your interest in Advanced Installer.

In order to achieve what you want you can follow the steps below:
- go in the Install Parameters page and create a new property (i.e. MYRESULTPROPERTY)
- go in the Search page and create a File Search (here you can search for the uninst.exe file)
- you can rename the search RESULT_PROPERTY (i.e. MY_FILE)
- go in the Custom Actions page, create a "Display message box" custom action and place it in the "Finish Dialog Stage" action group
- in the "Action Data" text field paste the following code:

Code: Select all

Are you sure you want to uninstall this program? | Title | MB_YESNO , MB_SETFOREGROUND , MB_ICONQUESTION | MYRESULTPROPERTY | [CLIENTPROCESSID]
- create your "Launch file or open URL" custom action and place it behind the "Display message box" custom action created earlier
- in the "Condition" field of the "Launch file or open URL" custom action write the following condition:

Code: Select all

(MYRESULTPROPERTY = "IDYES") AND (MY_FILE)
- build and run the project

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

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
neverhett
Posts: 6
Joined: Tue Mar 05, 2013 10:46 pm

Re: Uninstalling previously installed software on target sys

This is exactly what I was looking for! Thank you very much for the quick reply and helpful advice.

As a side question--is it possible to search in multiple directories for this file? I imagine it would be as simple as creating additional searches and naming the file "MY_FILE1", 2, 3, etc.. Then I could create a series of similar custom action chains with the different filenames?


Thank you once again!!
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling previously installed software on target sys

Hi,

Yes, you can search in multiple directories for one file.

As you said, you can create additional searches and then, if you want to use only one custom action, you can use a condition like this:

Code: Select all

(MYRESULTPROPERTY = "IDYES") AND ((MY_FILE1) OR (MY_FILE2) OR (MY_FILE3))
In this case the "Launch file or open URL" custom action will be executed only if the user clicked "YES" on the message dialog and the "uninst.exe" file is found in at least one of the directories you searched.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”