Hi,
When the user has used our program, we dont want the file to be deleted at un-install automatically, But we would like this to be optional, based on asking the user first.
This can be done by using a custom action. Here are the steps:
- go to the "Organization" page and for the component of the file set the "Do not register this component with Windows Installer" option
http://www.advancedinstaller.com/user-g ... rties.html
- this will make the installer to not remove the file during uninstall
- on the disk create a VBS file which contains this:
Code: Select all
strFilePath = Session.Property("PATH_TO_FILE")
set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(strFilePath)
- in the "Custom Actions" page add the VBS file as an
Attached custom action under "InstallExecuteSequence" -> "Uninstall"
- make sure that this custom action is set as
Immediate
- this custom action uses the Property PATH_TO_FILE in order to find the file which will be deleted
- you can set this property to point to the file with a custom action
- now you need to create a custom action which prompts the user during Uninstall and sets a property according to the user's choice (this custom action can show a message box and depending on what button is pressed it sets the value of a property); it is recommended to use a C++ DLL for this custom action
- the property set by the user's choice will be used to condition the custom action which removes the file
This will also require the same question if the file already exists at install (ie asking the user to overwrite the existing file)
This can be done by using a property to condition the component of the file. This property can be set by a checkbox in one of the installation dialogs.
You can read more about the Dialog Editor feature here:
http://www.advancedinstaller.com/user-g ... ditor.html
Regards,
Cosmin