Archive: ini files language strings


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,


You should write the language string into the INI file using WriteINIStr or the MUI_INSTALLOPTIONS_WRITE macro at runtime.


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 ?


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).


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 ?


There's not much point writing the language string to the page after displaying it.

Stu


The thing is that I tried to place the installoptions_write in many places but all without succes.

Maybe I should give up.


Maarten


What is databasemessage1?
It should either be Text or State depending on the control.

Stu


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


!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Field 1" "Text" "hi"

Stu


Thanks very much I got it working now