Old 16th June 2019, 14:01   #1
OneVoid
Junior Member
 
Join Date: Jun 2019
Posts: 5
Question 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
OneVoid is offline   Reply With Quote
Old 16th June 2019, 17:49   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,106
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th June 2019, 14:06   #3
OneVoid
Junior Member
 
Join Date: Jun 2019
Posts: 5
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,
OneVoid is offline   Reply With Quote
Old 17th June 2019, 15:40   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,106
Something like this:

Quote:
nsDialogs::SelectFileDialog open "%SystemRoot%\system32\CompanyName\Filever99752.dll" "\Filever99752.dll"
Pop $0 ; Result in $0

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th June 2019, 16:07   #5
OneVoid
Junior Member
 
Join Date: Jun 2019
Posts: 5
Talking

Quote:
Originally Posted by Anders View Post
Something like this:
Seems to work
code:

nsDialogs::SelectFileDialog open "%SystemRoot%\system32\system32\CompanyName\Filever99752.dll" "\FileverXXXXX.dll"
Pop $0 ; Result in $0
CopyFiles "$0" "$INSTDIR\Filever0.dll"

OneVoid is offline   Reply With Quote
Old 17th June 2019, 17:21   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,106
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.)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th June 2019, 19:13   #7
OneVoid
Junior Member
 
Join Date: Jun 2019
Posts: 5
Quote:
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?

code:

nsDialogs::SelectFileDialog open "%SystemRoot%\system32\CompanyName\Filever99752.dll" "\FileverXXXXX.dll"
Pop $0 ; Result in $0
CopyFiles "$0" "$INSTDIR\Filever0.dll"

OneVoid is offline   Reply With Quote
Old 17th June 2019, 20:10   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,106
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.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th June 2019, 20:58   #9
OneVoid
Junior Member
 
Join Date: Jun 2019
Posts: 5
Cool

Quote:
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
code:

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!
OneVoid is offline   Reply With Quote
Old 17th June 2019, 21:22   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,106
The last parameter is the filter for the bottom of the dialog, you can specify multiple sets.

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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump