Old 14th February 2011, 12:23   #1
herdell
Junior Member
 
Join Date: Sep 2010
Posts: 19
Browse button

Hi, I wanna a nsis script that changes the 'Browse' button properties. Instead show this when I click in 'Browse' button:



I need to replace to this:



Cause i'm a game translator, and my translations need to be installed in game install dir, so, if I can replace this function to search for the .exe of the game, instead of indicate the folder, would be nice.

Maybe it can do using installoptions with .ini file, or nsdialogs, but I don't know how.

Thanks in advance...
herdell is offline   Reply With Quote
Old 14th February 2011, 13:08   #2
Highcoder
Member
 
Join Date: Jan 2011
Posts: 69
You can use the standard Folder Dialog and combine it with .onVerifyInstDir.

Quote from NSIS Manual:
Quote:
This callback enables control over whether or not an installation path is valid for your installer. This code will be called every time the user changes the install directory, so it shouldn't do anything crazy with MessageBox or the likes. If this function calls Abort, the installation path in $INSTDIR is deemed invalid.

Example:
code:
Function .onVerifyInstDir
IfFileExists $INSTDIR\Winamp.exe PathGood ;replace with "somegame.exe" or "somegame.str"
Abort ; if $INSTDIR is not the game directory, don't let us install there
PathGood:
FunctionEnd



Should work for you and you don´t have to create a custom Page.

Sincerely...
Highcoder is offline   Reply With Quote
Old 14th February 2011, 16:14   #3
herdell
Junior Member
 
Join Date: Sep 2010
Posts: 19
I already use this to prevent the user choice the incorrect folder.

Anyway, thanks...
herdell is offline   Reply With Quote
Old 14th February 2011, 17:58   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Search for the exe before you display the directory page. You just need to set $INSTDIR. Also, avoid searching the file system if possible. You really should look for a registry value that tells you where the exe is. If you can't avoid searching the file system, make sure you indicate that a search is occurring using the Banner plug-in (or one of the more advanced ones such as nxs).

Stu
Afrow UK is offline   Reply With Quote
Old 15th February 2011, 08:49   #5
Highcoder
Member
 
Join Date: Jan 2011
Posts: 69
Re...

You want the installer to find the gamedir automatically so that the user don´t have to browse for thr right directory. Right?

Why don´t you simply read out the game install dir from registry?
Almost all games/apps store it´s installdir in registry under HKEY_LOCAL_MACHINE\Software\myGame\installdir or something...
Just look into registry an search for the right key.
So you can predefine $instdir in your nsis script.

code:
InstallDirRegKey HKLM "SOFTWARE\Activision\Call of duty Black ops" "installdir" <- example, i don´t know the right key


If the key was found $instdir contains the gamedirectory. If not it contains "" and you have to browse or you can do more checkups.
Highcoder 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