stb
8th April 2008 20:55 UTC
Change Name on runtime
Hi,
how to change "Name" (= installer name) on runtime? Docs say that I can use variables here if I initialize them in .onInit (I assume that means un.onInit for the uninstaller, too).
But this does not work here:
Var MY_NAME
Name "$MY_NAME"
At the end of .onInit and un.onInit I use
StrCpy $MY_NAME ${PROGRAM_NAME_NORMAL}
The latter one is a standard define:
!define PROGRAM_NAME_NORMAL "Normal Software"
Of course I have some alternative naming in .onInit (depends on some condition).
The installer shows an empty string for $(^NameDA) (e.g. on welcome page).
BTW: Can I easily override e.g. MUI_TEXT_WELCOME_INFO_TITLE for one of my languages?
kichik
8th April 2008 21:57 UTC
Works fine for me. Can you attach a full example?
OutFile nametest.exe
Var blah
Name $blah
Function .onInit
StrCpy $blah "asdasds"
FunctionEnd
Section
MessageBox MB_OK $(^NameDA)
SectionEnd
fabian.rap.more
8th April 2008 21:57 UTC
i don't know if the name can be changed but i know the caption can
http://nsis.sourceforge.net/Change_c...ler_at_runtime
edit:: kichik's example works fine
stb
8th April 2008 22:12 UTC
Fixed it by using quotes:
StrCpy $MY_NAME "${PROGRAM_NAME_NORMAL}"
stb
9th April 2008 12:21 UTC
Thanks, I have now variable Caption and Name.
But if I raise a MessageBox in .onInit the title is empty (""). It seems that Name (or Caption?) is evaluated only once after .onInit finished. It would be nice if it could be evaluated every time MessageBox is called (maybe it should be evaluated every time at all). Currently it is impossible to have a non-empty MessageBox title when Name (or Caption?) is set to a variable.
kichik
11th April 2008 13:12 UTC
Right, g_caption is reevaluated when the language changes. Probably in set_language(). I can't think of any solution for this at the moment.
stb
11th April 2008 13:17 UTC
Add a new command "SetLanguage"? (I know that this might not change strings that are already evaluated.)
Or internally call "set_language()" before a (non-silent) MessageBox is called?
kichik
11th April 2008 13:21 UTC
A feature request for source code changes should be opened regardless which will probably result in g_caption getting eradicated. But I can't think of a workaround for the current versions.