Hello and welcome to Advanced Installer forums,
Unfortunately, we do not have predefined support for your task.
However, this can be achieved through a
custom action. For instance, you can have a script (e.g. PowerShell, VBS) which will check if the path exists. If not, spawn a message box which will notify the user that the path does not exist and will ask for permission to create it.
If the user will give permission, continue with the installation. If not, exit the installation.
Here is a PowerShell script which will do exactly that:
Code: Select all
# Block for declaring the script parameters.
Param()
# Your code goes here.
Add-Type -AssemblyName PresentationFramework
$var = AI_GetMsiProperty APPDIR
if((Test-Path $var) -ne $true){
$messageBox = [System.Windows.MessageBox]::Show('The path does not exist, do you wish to create it on the machine?', 'AskForPermission', 'YesNo')
}
switch ($messageBox) {
'Yes' {
AI_SetMsiProperty CONTINUE_PROPERTY "Yes"
}
'No' {
exit 3
}
}
In order to implement this in Advanced Installer, you can proceed as it follows:
- go to
"Custom Actions" page
- add a
"Run PowerShell Inline Script" custom action,
without sequence. In order to add a custom action without sequence, simply press the
"Add custom action without sequence" button which is placed to the right side of the CA name.
- copy paste the code from above
- go to
"Dialogs" page
- click on the
"FolderDlg" dialog
- click on the
"Next" button. Under
"Published Events" tab, create a new event as it follows:
Event: Execute custom action
Argument: PowerShellScriptInline
Condition: leave unchanged
Schedule it at the top of the events list by clicking it and pressing the
"Up" button.
Now, under the same tab, double click on the
"Display a specific dialog" event and set its condition to:
In the script, we set this property if the user presses
"Yes".
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging