Archive: get file dialog


get file dialog
hello

I need a custom page with a button for filesystem.
user clickt button, select *.reg file.
and regedit run the file after that.
It's something like "MUI_PAGE_FILE"
but there is only MUI_PAGE_DIRECTORY
how can I do it?
only one option: FileRequest exist?
I use MUI

Thanks.


Checkout the included examples.
InstallOptions is what you're lookinng for,

http://nsis.sourceforge.net/Docs/Ins...ns/Readme.html


You can create a custom page (Page custom fn_enter fn_leave) using InstallOptions or nsDialogs. InstallOptions might be easier for you to get up and running with as there are many examples. nsDialogs is still relatively new but appears to be more future-ready.

Within the custom page you can create a FileRequest field, which can pop up a file browsing dialog. Seems to be what you're looking for.


super!
Thank You for answers!
I try it.


I created custom page with Type=FileRequest.
But I want the page would be like MUI_PAGE_DIRECTORY.
At first is next-button deactivate.
only if selected file exist, user can go on.
how can I do it?

Thank You.


disable the button in the custom page enter function:


GetDlgItem $0 $HWNDPARENT 1 ; Next button
EnableWindow $0 0


Then in the custom page leave function, check if the file exists, and enable it if it does, disable if not:

; assume $1 to hold the filename
GetDlgItem $0 $HWNDPARENT 1 ; Next button
IfFileExists $1 _enable _disable

_enable:
EnableWindow $0 1
goto _done

_disable:
EnableWindow $0 0

goto _done
_done:


Make sure you set the flag FILE_MUST_EXIST in the filerequest control of your installoptions.ini file as well. This won't prevent a user from entering an invalid file in the textbox (which is why you still need to check it in the exit function), but it will warn the user that the file is invalid (doesn't exist) when they are using the file browse dialog.

Thank You,
I can deactivate next button now.

Next button must be activated, if the license file exist.
If next button is deactivated, I cann't reach leave-funktion. It is something like fileopen-event of FileRequest,where I can check the file and activate next again.


You should be able to set a NOTIFY flag on the filerequest. That will cause the leave function to be called. You'll have to check the status of the installoptions file to see whether the user used the filerequest control or the next button or some other element in your dialog to deal with code handling. Make sure to call 'Abort' for any of the things that aren't the Next button, so that the installer will remain on the same page (i.e. your dialog)