Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 23rd May 2007, 19:39   #1
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
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,
Maartenmostert is offline   Reply With Quote
Old 23rd May 2007, 19:45   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
You should write the language string into the INI file using WriteINIStr or the MUI_INSTALLOPTIONS_WRITE macro at runtime.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th May 2007, 07:38   #3
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
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 ?
Maartenmostert is offline   Reply With Quote
Old 24th May 2007, 10:15   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,338
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).

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 24th May 2007, 11:21   #5
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
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 is offline   Reply With Quote
Old 24th May 2007, 15:11   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
There's not much point writing the language string to the page after displaying it.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 29th May 2007, 14:51   #7
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
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 is offline   Reply With Quote
Old 29th May 2007, 15:02   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
What is databasemessage1?
It should either be Text or State depending on the control.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 29th May 2007, 15:35   #9
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
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
Maartenmostert is offline   Reply With Quote
Old 29th May 2007, 16:54   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,216
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Field 1" "Text" "hi"

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 31st May 2007, 12:10   #11
Maartenmostert
Junior Member
 
Join Date: May 2007
Posts: 7
Thanks very much I got it working now
Maartenmostert is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump