Cdzitu
26th December 2003 20:15 UTC
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?!
kichik
26th December 2003 20:21 UTC
See Examples\one-section.nsi for an example that does exactly that.
Cdzitu
28th December 2003 21:30 UTC
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.
Joost Verburg
28th December 2003 22:01 UTC
Use $\r$\n for a Windows newline.
Cdzitu
29th December 2003 22:46 UTC
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
30th December 2003 12:14 UTC
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
30th December 2003 13:24 UTC
Hihi, didn't think on that! :D Will try later!
Cdzitu
2nd January 2004 02:23 UTC
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
2nd January 2004 12:05 UTC
FileRead reads line by line. You have to use a loop in order to read more than one line. See this example:
http://nsis.sourceforge.net/archive/....php?pageid=17