Baafen
30th August 2006 18:28 UTC
Writing to ini
Im trying to make an installer that writes to an ini file. I have made so the ininstaller writes what I entered in field 1-6 but I wont to make så whats entered in field 1 has "" so If I enter test the installer should write "test" but that wont work.
Write code:
FileWrite $9 "$0 $1 $2 $\r$\n"
I have tryed:
FileWrite $9 ""$0" "$1" "$2" $\r$\n"
But then I get an error then i try to compile.
Is there an better way to write to the ini file?
I would like to have to ability to choose what line to write to. For example if there is some text in the ini file i should write it to a new line. For example line 33.
// sorry for my bad english I hope you understand me
Afrow UK
30th August 2006 18:39 UTC
What is wrong with WriteINIStr?
-Stu
Baafen
30th August 2006 19:11 UTC
I can try WriteINIStr but can I make "$1" then?
I tryed it and didnt get what I wontet. I field 1 you enter one thing and in field 2-3 you enter something other. and I wont it to write like this: "thing1" "thing2" "thing3" but I was not able to do that
Afrow UK
30th August 2006 22:47 UTC
Like this:
WriteINIStr "$PLUGINSDIR\file.ini" "Field 1" "State" '"thing1" "thing2"'
-Stu
Baafen
31st August 2006 12:02 UTC
Now I get " but its still like I wont it to be.. In the ini files I get
[Field 1]
State="thing1" "thing2"
But I only wont
"Thing1" "Thing2"
Comperio
1st September 2006 00:27 UTC
Seems what you want is not a standard INI file...
Look at the Text Function headers included with NSIS. There are some text file manipulation function that might work better for you. (the LineFind function might be what you are looking for.)
You might also want to browse the NSIS Developer Center for other plugins/functions that would help you achive your goals.
If you are still stumped, it might help to post a few example lines from your unique INI file to better illustrate what you are trying to accomplish.
Baafen
1st September 2006 15:56 UTC
Thanks I will take a look at that and see if I can make it work :)