Skip to content
⌘ NSIS Forum Archive

Disable of Browse button & forcing directory folders

3 posts

Naina#

Disable of Browse button & forcing directory folders

Hello,

I am using Nullsoft installer for creating directories in my project. The folders always start from the C:\ or D:\ For exmaple C:\folder1\folder2.

I want to know if we can force the folders as i want it to start only from C:\ or D:\ so that user should not choose any other folder.

I also want to know if we can disable to browse button. Is there any function or library to handle the same?

Please get back to me if anyone has worked on this.

Thanks,

Naina
n_baua#
Hi Naina,

Locate and comment the line in your code
; !insertmacro MUI_PAGE_DIRECTORY

This will not present the user with the directory browsing screen it self and user will always be forced to install in a pre-decided directory.

I assume this solves your query.

-Nhilesh
Comperio#
You can use the .onVerifyInstDir callback function to check for the proper path. Calling "abort" in that function will automatically keep the 'NEXT' button grayed out until the user picks the proper path (either by typing or browsing), so that might eliminate the need for disabling the browse button. However, if you still desire that, then you need only search the forums to find out how you might accomplish it. (this article would be a good start.)

You can also use a leave function to do the directory check. The advantage of leave function is that you can display a friendly message to the users when they try to continue to let them know why they can't move on.

You might also consider creating your own custom page instead of using the stock directory page. (you'll have to decide which is best.)