Archive: FileRequest


FileRequest
I created some custom pages for user input. There I use a FileRequest control to let the user enter the path and filename to a log file which is created later on by the installed application

[Field 3]
Type=FileRequest
Flags=FILE_EXPLORER|REQ_SAVE|WARN_IF_EXIST|PROMPT_CREATE
Filter=Comma Delimited Text (*.csv)|*.csv|Text (*.txt)|*.txt
Left=63
Right=255
Top=62
Bottom=75

When I use the browse button, to create a new file in the specified path, the result I get is the correct path and filename but without an extension. The PROMPT_CREATE flag is also not to executed, whereas WARN_IF_EXIST works as expected.
How can I get the path and filename to be displayed with the correct extension according to the chosen filter?

I'm using a development snap shot downloaded on 2003-11-08.

Many thanks for this highly useful piece of software. Great work.

Regards


On both XP and 98 PROMPT_CREATE only works without REQ_SAVE. Since those two just translate to flags for GetOpenFileName or GetSaveFileName I have to assume this is a Windows bug, feature, documentation bug or whatever you want to call it. I'll update InstallOptions' readme. Thanks.


Yes, without the REQ_SAVE the PROMPT_CREATE works.
Sadly, it doesn't matter if I use REQ_SAVE or PROMPT_CREATE the result which is displayed in the State field does not contain the extension specified by the filter. Any idea how to get this?

Regards


Works fine for me. Mind attaching an example installer with source code?


I would highly appreciate if you could tell me what I did wrong. Thanks.


Still works fine here. Try RC1. You'd need to update the icon paths once upgrading as they've moved to Contrib\Graphics.


Thanks for trying my script kichik. I reall don't understand why it works for you. I now use rc2 and asked a friend to download nsis and compile the script for me. It still doesn't work here.

To get straight thta we really talk about the same....I use the browse button to call the save file dialog. the filter is set to *.txt. I enter the filename *without* the extension and confirm the dialog. The path and filename appears in the input box but is missing the extension. I could even specify a filename with *.exe although the filter is set to *.txt. It is like in Word when saving a document, I only type the name and I know it will be saved with the extension *.doc as specified in the file dialog.

Regards


The filter parameter only sets filters the user will be able to choose from. It doesn't force him to use those. A user can easily type *.* and hit and enter to get a complete list of all of the files, regardless of the filter.

There is a parameter that auto appends a default extension for this API function. Add a feature request on SourceForge and we'll probably add it. Just not at the moment because we want to get b4 out first.


The code runs ok.
I have a question.
The script came very handy because I wanted to prompt the user to enter the directory of the sqlserver databases.
Of course with the filerequest the user selects a certain file.
Is there a way, except string manipulation, that the user can just select a folder using this dialog?

ps how do I get the full path in astring?Does State do the job?
thanx!!


You can use DirRequest instead of FileRequest to get the user to select a directory. If you want to get the directory according to the selected file, you'd have to use string manipulation. But there is a pre-ready function called GetParent in the documentation, so you don't have to reinvent the wheel.

Yes, state contains the full path.


thank u very much!