Hello Edward and welcome to Advanced Installer forums,
In order to achieve this, we will have to retrieve the version number from the previously installed version of our product.
In order to do so, we will need a
custom action.
Here, you can use any language that you are familiar with. For instance, I have used PowerShell and here is how the script looks like:
Code: Select all
# Block for declaring the script parameters.
Param()
Add-Type -AssemblyName PresentationFramework
# Your code goes here.
Write-Output "Hello world"
$appName = AI_GetMsiProperty ProductName
$app = Get-CimInstance -ClassName Win32_Product | Where-Object {$_.Name -match "$appName"}
$msgBox = [System.Windows.MessageBox]::Show("You are about to uninstall version $($app.Version) of $appName. Do you want to proceed?",'Title Here', 4)
switch ($msgBox){
'Yes' {
# do something
}
'No' {
# do something
}
}
The above can be implemented in Advanced Installer as a custom action
without sequence.
You can do so by going to
"Custom Actions" page and adding a
"Run PowerShell script inline" custom action, without sequence (by pressing the
"Add custom action without sequence" button which is located to the right side of the custom action's name)
After doing so, we can now schedule the custom action as an
"Init Event" on our first dialog. To achieve this, please go to
"Dialogs" page --> select
"WelcomeDlg" and, under
"Init Events" tab, please add a new event as it follows:
Event: Execute custom action
Argument: PowerShellScriptInline
Condition: leave unchanged
This way, when the dialog is initialized, the custom action will be triggered. In the end, it will look something as it follows:

- YesNo.png (116.36 KiB) Viewed 2797 times
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging