Use OpenFileDialog() to select a file or path to a non-existing file


my target is as follows:
I do have an application which can access a SQLite database.
In case that the file exists it makes use of it. In case that the file does not exist it is going to restore a template file from virtual file storage.
Within the settings configuration of my application I can define a path to the .db file.

In case that a .db file exists all works as expected.
In case that no .db file exists I get the feedback that I must select a valid file.

Is there any way that I can only make use of it to define a path to a file even when the file does not exist?


Sure, just write the PHP script to check for the existence of the .db file. If not existing, run the HEScript code that you wrote to invoke OpenFileDialog. There is a sample code in the doc.

Thanks for your reply!
My problem happens 1 step earlier.


  • user starts the application the 1st time
  • The application does not know if the user wants to create a new database or connect to an existing database, therefore the OpenFileDialog shall be used to define a path.
    → in case that a file exists at the selected location then the file will be used
    → in case that there is no file at that location then it will be created at the selected path

My problem is that I cannot select a path as the OpenFileDialog requires me to select a file. If there is no file on my HDD I cannot continue.

I need something like OpenCreateFileDialog :slight_smile:

Best regards,

Then, you could create a simple message box for instance to ask whether the user wants to create a new database or open an existing file. If “open an existing file” is chosen, you call OpenFileDialog.

Good idea!
But what could I do if the user wants to create a new file? :slight_smile:
Asking the user to type the path manually in a textbox is not so userfriendly. This is why I would prefer some kind of Dialog box.

Maybe you could just ask the user for the filename and automatically create the file in a given folder, such as the My Documents or the write folder dedicated to your app.


this is the point of using OpenFileDialog. It is about a SQLite database. The user might either want to store it on Drive D:/, Drive C:/ or a network share.
This is nothing I can predefine or know upfront. The user might also have multiple databases which could be named differently so not even defining a folder is a workaround.

Would it possible to add another parameter to the function in ExeOutput OpenFileDialog() like “aAllowEmptyFile” which can either be true or false.
false is the default value which leaves evertyhing as it is at the moment.
If set to true then the user can define a file.

When the user clicks “OK” then the full path including the file will be returned instead of throwing a message that the file does not exist.

I hope that makes sense to you.

Best regards,

1 Like

Yes, that makes sense. I think we can probably send you a modified runtime to include that option. I sent the query to our developers.


Awesome! Thanks a lot for your support!

Best regards,