Skip to content
⌘ NSIS Forum Archive

4 sections, only one to choose!

9 posts

Cdzitu#

4 sections, only one to choose!

Hi, i'm using the NSIS CVS and the default interface, my installer has 2 subsections within 2 sections each one, so i have 4 sections. 🙂 I must make them to be exclusive so the user can only choose one of them. I had a look at the manual but didn't find anything that IMO can help me. Do any of you got any suggestion?!
Cdzitu#
Okk, thanks kichik. It worked fine. Now i have another doubt but don't wanna post another topic. 😉

I need to write some things to a text file, but i want them to be in diferent lines. I tried something like this:

section
fileopen $0 path\file.txt w
filewrite $0 "1 $\n 2 $\n 3"
fileclose $0
sectionend

It didn't work, thanks for your help.
Cdzitu#
Okk, thank you Joost. Here it goes another dumb doubt by me. :/

I have a text file like this, for instance:

word
word
word

I need tried to put a string on it but i got
something like this:

stringword
word
word

I would like to know a way to put the string in the last line or like this:

string
word
word
word

Or some other weird thing. I've tried:

...
FileWrite $0 "$\r$\nSTRING"
...

And:

...
FileWrite $0 "STRING$\r$\n"
...

None of them worked. See you!
Joost Verburg#
If you want to put it on top of the other strings, read the content and then write it back including the new string.
Cdzitu#
Hi Joost! I tried it and it worked fine but i could only make it work with text files with only one line. I'll post below what i tried.

Name TEST
SetOverwrite on
OutFile "C:\Windows\Desktop\test.exe"
Section
FileOpen $0 C:\Windows\Desktop\test.txt R
FileRead $0 $1
FileClose $0
FileOpen $0 C:\Windows\Desktop\test.txt W
FileWrite $0 "$1$\r$\nOK"
FileClose $0
SectionEnd

And i wrote this on test.txt:

Testing...
Testing...
Testing...

When i run the test.exe file, i get this in test.txt:

Testing...

OK

What should i do to make it work?
kichik#
FileRead reads line by line. You have to use a loop in order to read more than one line. See this example: