Hello and welcome to Advanced Installer forums,
I've been working with AI for just a week now and this is actually the first time ever for me to write in a forum. So i hope I'm doing the right thing here.
Yes, you can ask your questions either here or over the e-mail at
support at advancedinstaller dot com.
In what regards your question, here is how I see it achieved:
A brief description of what we are trying to achieve here:
If you go to "
Dialogs" page, click on your "
UserInformation" dialog and then select the "Next" button you can notice, under "
Published Events", an event as it follows:
Event: Display a specific dialog
Argument: SomeDialog
Condition: AI_INSTALL (which translates to: this event will execute on an installation)
Basically, what we want to do here is extra conditioning that event, so that we will not allow the installation to continue until our condition is met. Additionally, here, we will add another event. This event will execute a custom action (in this case, our predefined MessageBox custom action), which will notify the user of what he needs to do in order to complete the installation.
Please find a more detailed explanation below:
- first of all, this:
in this "User Information" dialog I diaplay the information from the WibuKey if the script could successfully read it. In this case the installation should just proceed by clicking on NEXT.
Your script should contain the logic which decides if the information was correctly read from the WibuKey. To be fully honest with you, I am not so comfortable with how this security check works, but I would guess that one condition to retrieve the data is the file from where the data is retrieved should exist on the system. Based on that, we can have a condition as it follows:
Code: Select all
if (the file exists){
the data was correctly read
}
else {the data was not read}
- above, we said that we need to extra condition the
"Display a specific dialog" event, so that the installation process will not proceed until our conditions are met. We can do this with the help of
Windows Installer Properties. Properties are global variables used by Windows Installer during an installation.
Depending on what custom action you are using, here is how you can get & set properties from within a custom action:
"How to set an installer property using custom actions"
Now that we have explained this, here is how the logic in your script could look like:
Code: Select all
if (condition = true){
// the data was correctly read
Set a property to some value which indicates success
e.g. CONTINUE_INSTALLATION_PROPERTY=1
}
else {
// the data was not correctly read
Set a property to some value which indicates failure
e.g. CONTINUE_INSTALLATION_PROPERTY=0
}
- now, based on the above property, we can condition the dialog event. Here is how you can do so:
1. go to
"Dialogs" page
2. select your dialog
3. click on the
"Next" button
4. under
"Published Events", double click on the
"Display a specific dialog" event and, in the condition field, use a condition as it follows:
Until the above property is set to "1" (the data was correctly read), we will not allow the installation to continue.
- now, we should move on with the message box custom action. In order to add such a custom action to your project, please go to
"Custom Actions" page, select the
"Display message box" custom action and click on the
"Add custom action without sequence" button which is placed to the right side of the custom action's name.
- enter the details (i.e. the message, the title, etc.)
- now please go back to
"Dialogs" page
- select your dialog and click on the
"Next" button
- under the same
"Published Events" tab, add another event, as it follows:
Event: Execute custom action
Argument: MessageBox
Condition: CONTINUE_INSTALLATION_PROPERTY=0
We will spawn this message box only when the data could not be read. In the
"Published Events" tab, please schedule message box event before the display event. To do so, simply click on the message box event and press the
"Up" button.
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging