Skip to content
⌘ NSIS Forum Archive

Browse for dll

10 posts

OneVoid#

Browse for dll

I have a program that needs to use a DLL that is constantly updated,
This wouldn’t be too big of an issue if they didn’t include version no. in the file name.
my plan is to just retrieve the installer for the latest version and have the wizzard wait till that's done.

I think the solution would be to make a duplicate from its default installed location under a new name.

How do I make the installation wizard open up a dialogue box to browser for a file
In “%SystemRoot%\system32\CompanyName\”
To select
Filever99752.dll

And make a duplicate in the programs installed (specified by the user earlier in the wizard) directory as Filever0.dll

Many thanks for help
Anders#
You can't control where this other installer puts its files? See http://unattended.sourceforge.net/installers.php

You could try to use FindFirst etc. to find the file. nsDialogs::SelectFileDialog can be used to select a file.
OneVoid#
I cant modify the installer (of the library needed)
and i don't know of any ways to control it.

I was testing out the command by adding it to Example1.nsi

nsDialogs::SelectFileDialog mode initial_selection "%SystemRoot%\system32\CompanyName\Filever99752.dll"
It opens up in the location of the instalation exe what am i doing wrong?
I also tried C:\Windows\system32\... still the same issue.

how do i copy it over as "Filever0.dll" in INSTDIR,
Anders#
Something like this:

nsDialogs::SelectFileDialog open "%SystemRoot%\system32\CompanyName\Filever99752.dll" "\Filever99752.dll"
Pop $0 ; Result in $0
OneVoid#
Originally Posted by Anders View Post
Something like this:
Seems to work

nsDialogs::SelectFileDialog open "%SystemRoot%\system32\system32\CompanyName\Filever99752.dll" "\FileverXXXXX.dll"
Pop $0 ; Result in $0
CopyFiles "$0" "$INSTDIR\Filever0.dll"
Anders#
Just keep in mind that $0 will be empty ("") if the user cancels the dialog. If this is a important file then you need to tell the user (Give them the option to find the file again or abort the installer.)
OneVoid#
Originally Posted by Anders View Post
Just keep in mind that $0 will be empty ("") if the user cancels the dialog. If this is a important file then you need to tell the user (Give them the option to find the file again or abort the installer.)
I plan to run the installer for the third party component in this scenario but
I think it would be a good idea to put this option in the Repair section of Install/Repair.

Getting different results on other computers i tested it on
usually opening My Documents and or having "%SystemRoot%\system32\CompanyName\FileverXXXXX.dll" in the file name section
but not every time it is run
it only seems to work correctly on the computer i compiled it on, i assume that one has the directory cached?

Is there something i can do to make sure it opens in the correct folder?


nsDialogs::SelectFileDialog open "%SystemRoot%\system32\CompanyName\Filever99752.dll" "\FileverXXXXX.dll"
Pop $0 ; Result in $0
CopyFiles "$0" "$INSTDIR\Filever0.dll"
Anders#
Replace %SystemRoot% with $SysDir and "\FileverXXXXX.dll" should be "FileverXXXXX.dll" or maybe something like "FileverXXXXX.dll|FileverXXXXX.dll|DLL files|*.dll". Windows can however ignore your default.
OneVoid#
Originally Posted by Anders View Post
Replace %SystemRoot% with $SysDir and "\FileverXXXXX.dll" should be "FileverXXXXX.dll" or maybe something like "FileverXXXXX.dll|FileverXXXXX.dll|DLL files|*.dll". Windows can however ignore your default.
so

nsDialogs::SelectFileDialog open "$SysDir\CompanyName\Filever*.dll" "Filever*.dll"
Pop $0 ; Result in $0
CopyFiles "$0" "$INSTDIR\Filever0.dll"
Thankyou i am having much better luck with this!
Anders#
The last parameter is the filter for the bottom of the dialog, you can specify multiple sets.

nsDialogs::SelectFileDialog open "$SysDir\CompanyName\Filever1234.dll" "Filever*.dll|Filever*.dll|DLL files|*.dll|All Files|*.*"
Pop $0 ; Result in $0