Potz
13th June 2006 19:16 UTC
Question about user input from INI to text
I know that getting what a user has input is something like this
ReadINIStr $R1 "ServerIP.ini" "Field 2" "State"
and writing to a text file is
FileWrite $0 "some text"
Now what I am wondering is how do you go from taking text from the text box of the ini file and putting it into the text file.
kgobel
13th June 2006 19:29 UTC
almost seems like you answered your own question..
The first line reads what's in the text box and stores it in $R1 (a variable sortof), then if your second line is right...then all you would have to do is replace the "some text" with $R1...(I believe)
Try it out and see if that works, I'm not really sure, I'm brand new to NSIS and have never used the FileWrite function before..if it doesn't work post back and i'll get it working
Potz
13th June 2006 19:35 UTC
Yeah I tried that... didn't work. It did work if I did leave is just "test" or "some text" though. I would really appreciate it if I could figure it out, it has really been bugging me lol... no matter where I look I can't seem to find any good example code for something like this.
Afrow UK
13th June 2006 20:22 UTC
ReadINIStr $R0 "$PLUGINSDIR\ServerIP.ini" "Field 2" "State"
FileOpen $R1 "$INSTDIR\file.txt" w
FileWrite $R1 $R0
FileClose
Can't be any simpler really.
Just make sure you use the code in the custom pages' Leave function:
Page Custom ShowFunc LeaveFunc
-Stu
Potz
13th June 2006 20:31 UTC
Ohhh ok I must have forgotten $PLUGINSDIR... I figured it was something simple. Thanks Afrow UK
Afrow UK
13th June 2006 20:37 UTC
No problem. I guessed that might be the issue. You can
!insertmacro MUI_INSTALLOPTIONS_READ "ServerIP.ini" "Field 2" "State"
if you want instead (which puts $PLUGINSDIR in for you).
-Stu