HericK
Posts: 12
Joined: Thu Dec 01, 2016 8:58 am

Check file exist in sequence

Hi,

I need to check if a user named file exist before use it.
The file is a Firebird database and the goal is :
- If file not found : create it with a custom action
- If file exist, update it with another custom action

I cannot use a search, because I must wait the name given by user in dialogs.

How can I do this ?

I'm working with AI entreprise v14.4.2

Thanks for your help
Eric
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Check file exist in sequence

Hello Eric,

Since the filename must be set through user input you will have to use another custom action to search for the related file too. You can get the user input through an edit box control.

Then from your custom action you can access the value of the edit box associated property and perform the file search. based on the result your custom action could set another property. The latter property (search result property) can be further on use to condition the execution of your file exists or file not found actions.

You can take a look on our "How to set an installer property using custom actions" article which could be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HericK
Posts: 12
Joined: Thu Dec 01, 2016 8:58 am

Re: Check file exist in sequence

Hello Daniel,

Thanks for reply.
I will try your suggestion today, but I have already try to run a search after a user input and I always have a blank property.

I read into the AI help :

Caution! Windows Installer does not guarantee the searches order, so a new search should not use the result of another search.
Note : If the installation package is run with full UI, the searches will be performed only once during AppSearch standard action from the Wizard Dialogs Stage.

How can I force a search after user input ?

English is not my natural language perhaps I don't understand correctly the documentation.
Did you confirm I can run a file search when I want between 2 dialogs ?

Thanks for your help
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Check file exist in sequence

Hello Eric,

I apologize for my previous reply. I think it wasn't so clear.

What I meant to say was that you cannot use our "Search" page support. This is because as you already read and correctly understood the searches defined in "Search" page are always executed before the UI dialogs appear when running the setup package with UI.

The only method will be to write your own code to search for the related file and run your own app (which searches for that file) using a custom action.

Just let me know if you have any further questions.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HericK
Posts: 12
Joined: Thu Dec 01, 2016 8:58 am

Re: Check file exist in sequence

Hello Daniel,

Thank you for confirming that I understood the operation of the predefined searches.

I will continue searching with a dll function called from a custom action

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

Re: Check file exist in sequence

You are always welcome Eric.

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

Return to “Building Installers”