Skip to content
⌘ NSIS Forum Archive

ini files language strings

11 posts

Maartenmostert#

ini files language strings

Hi,

I am new to NSIS and would like to know how to use laguage strings in ini files using custom pages using the new interface.

Thanks in advance,
kichik#
You should write the language string into the INI file using WriteINIStr or the MUI_INSTALLOPTIONS_WRITE macro at runtime.
Maartenmostert#
Thanks,

I tried the WriteINISTr command like this:

Function CustomPageA

------------------------
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
WriteINISTR "ioA.ini" "Field 1" "databasemessage1" dbMessage1

FunctionEnd
------------------------

The compiler will give me the following log.

------------------------
Function: "CustomPageA"
!insertmacro: MUI_HEADER_TEXT
!insertmacro: end of MUI_HEADER_TEXT
!insertmacro: MUI_INSTALLOPTIONS_DISPLAY
!insertmacro: end of MUI_INSTALLOPTIONS_DISPLAY
WriteINIStr: [Field 1] databasemessage1=dbMessage1 in ioA.ini
FunctionEnd
------------------------

So he sort of have seemed to understood.

My ini file starts as follows:

-------------------------
[Settings]
NumFields=5

[Field 1]
Type=label
Text=databasemessage1
Left=0
Right=-1
Top=0
Bottom=9

-------------------------


So I have no errors but nothing is changed as still have the databasemessage1 displayed on my custum page instead of the contents of the language string dbMessage1.


I haven't found any doculentation on the MUI_INSTALLOPTIONS_WRITE macro ?
kichik#
MUI_INSTALLOPTIONS_WRITE is documented in the MUI readme and is the macro you should use in this case. If you're using the MUI to extract and display the page, you should use it to modify the page.

If you use WriteINIStr, you must use a full path ($PLUGINSDIR\ioA.ini).
Maartenmostert#
My custompage function is now as follows:


--------------------------------
Function CustomPageA

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Field 1" "databasemessage1" "hi"

FunctionEnd
--------------------------------

Again no errors but no results either.

Is this the right place to put this macro ?
Maartenmostert#
The thing is that I tried to place the installoptions_write in many places but all without succes.

Maybe I should give up.


Maarten
Maartenmostert#
Hi

Thanks for the reply.

databasemessage1 is what is to be replaced in my ini.file which starts as follows:

[Settings]
NumFields=5

[Field 1]
Type=label
Text=databasemessage1
Left=0
Right=-1
Top=0
Bottom=9