Archive: How to get user input and write that to an env var?


How to get user input and write that to an env var?
  I simply want to ask the user to enter a nickname and write
that nickname to an env var that is later used when the
installed program runs.

Can the basic NSIS do this? How?

If not are there any mods/add-ons etc that can help me
accomplish this?

Any example of this or similar?

Thanks in advance!


Use InstallOptions to get input from the user.

nstallOptions gives you the ability to create custom pages during installation. It can also get input for you such as another directory.

If you want to show one custom page right after the other use MultIni4 or the new macros in the Modern UI (avaiable in the latest CVS version).


If you wish to set env strings use WriteEnvStr.

If you are using the latest CVS version you can replace:


GetTempFileName $2

File/oname=$2 "RefreshEnv\Release\RefreshEnv.exe"
>ExecWait $2
Delete$2
>
with:

SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 

>0 "STR:Environment" /TIMEOUT=5000
>
Then you won't need RefreshEnv.exe

You will have to include ${NSISDIR}\Examples\WinMessages.NSH for this change to work.