DavidWCox
Posts: 6
Joined: Thu Jan 03, 2013 3:36 pm

Error message if search fails then reprompt

Hello,

I want to display an error message if a certain file does not exit. I have the search setup that works, but I am unsure of how to use the search to display the error message. Ideally, I would like the search to take place immediately after the user presses the Next button on the dialog. So the steps would be:

1. User enters a path in the dialog.
2. User presses the Next button.
3. The install searches for a file in the path the user entered. If the file does not exist, an error message is displayed and the user is returned to the path prompt in the dialog.

Is this possible and if so is there a “how to” or tutorial that shows how to accomplish the above steps? If I can't search after each dialog (there are 4 of them) is there a way to check for the search before the installation of files and then have the user start over again?

Thanks in advance,

Dave
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Error message if search fails then reprompt

Hello Dave,

In order to achieve what you want you can add on the [Next>] button a "Display a specific child dialog" published event like this:
  • Name: Display a specific child dialog
    Argument: <NewDialog>
    Condition: your condition
Let us know if this helps, otherwise give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DavidWCox
Posts: 6
Joined: Thu Jan 03, 2013 3:36 pm

Re: Error message if search fails then reprompt

Hi Daniel,

Thanks for the response. I am still struggling to get this to work. I have a two questions:

1. The search condition appears to return 0 (false) even when the file is present. Just by using the search condition in the “Display a specific child dialog” does the search take place automatically or is there something else I need to do? I am checking for an error using ‘SRCH_CONDITION <>1” for the “Display a specific child dialog” condition.

2. Once I have the above working, how do I skip my error dialog if the file is found? The Next always wants to display the next dialog in the list.

Thanks,

Dave
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Error message if search fails then reprompt

Hello Dave,

Please keep in mind that searches from "Search" page are performed during "Wizard Dialogs Stage -> Searches -> AppSearch" standard action when your installation package is launched with Full UI. So, the searches are performed before "WelcomeDlg" will appear. If you want to use a search from "Search" page to condition your error message you can proceed like this:
- Go to "Search" page and add a file search (e.g. SRCH_CONDITION).
- Go to "Dialogs" page, create a new dialog and on [Next>] button add the following published event (scheduled as last event in the "Published Events" list):
  • Name: Display a specific child dialog
    Argument: <New Dialog>
    Condition: NOT SRCH_CONDITION
- Build and run your project.

Here's attached a sample, created using version 9.8 of Advanced Installer, which implements a similar scenario.
sample.zip
(3.08 KiB) Downloaded 295 times
Also, if you want to perform the file search after the user enters a path, then you should create your own custom action which will do that and will set a property (e.g. SRCH_CONDITION) depending on search result. You can take a look on "VBScript to search for and delete file" article which may be useful for you. In this case on the [Next>] button you should add a published event like this:
  • Name: Execute custom action
    Argument: Your custom action without sequence
before the "Display a specific child dialog" published event.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”