Archive: Change Name on runtime


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?


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

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


Fixed it by using quotes:

StrCpy $MY_NAME "${PROGRAM_NAME_NORMAL}"


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.


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.


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?


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.