- NSIS Discussion
- Input Box
Archive: Input Box
arfinator853
22nd February 2005 23:17 UTC
Input Box
This is probrally a nooB question but, I need to create 5 input boxes that will be on a custom page. The data that is filled into these should be put into a variable.
I've been searching through the foruns, readmes, and even in the MUI system.nsh but to no avail. I'm probrally not looking at the right thing.
Does anybody have any ideas? Any and all help would be appreciated.
Thanks in advance! :D
Arfy
Anders
23rd February 2005 03:22 UTC
\nsis\contrib\installoptions
Joel
23rd February 2005 03:39 UTC
/me points to HM NSIS Editor
wait! we aren't in the channel :D
A good edit will help
arfinator853
23rd February 2005 04:27 UTC
Here is my function code for that custom page:
Function mysql
GetTempFileName $R0
File /oname=$R0 mysql.ini
Pop $R1
done:
FunctionEnd
Here is the .ini file I created using HM Edit
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=10
Title=MySQL connect options
BackEnabled=0
CancelButtonText=Cancel
NextButtonText=OK
BackButtonText=< Previous
[Field 1]
Type=Text
State=localhost
Left=49
Right=172
Top=7
Bottom=20
[Field 2]
Type=Label
Text=Host
Left=8
Right=22
Top=9
Bottom=17
[Field 3]
Type=Label
Text=Port
Left=5
Right=18
Top=28
Bottom=36
[Field 4]
Type=Label
Text=Username
Left=5
Right=37
Top=55
Bottom=63
[Field 5]
Type=Label
Text=Password
Left=5
Right=36
Top=72
Bottom=80
[Field 6]
Type=Label
Text=Database
Left=5
Right=36
Top=96
Bottom=104
[Field 7]
Type=Password
Left=49
Right=172
Top=70
Bottom=83
[Field 8]
Type=Text
State=root
Left=49
Right=172
Top=54
Bottom=67
[Field 9]
Type=Text
State=SAMDB
Left=49
Right=172
Top=93
Bottom=106
[Field 10]
Type=Text
State=3306
Left=49
Right=100
Top=25
Bottom=38
I need all of these fields to save to a variable in the installer so they can be pulled up again later when I need to alter the mysql database. Right now, these two files are just the login details that the user has for his database.
I am so confused right now, so any and all help would be appreciated!
Thanks!
Arfy!
Joel
23rd February 2005 14:08 UTC
Since is an INI file, try the INI instruction like ReadINIStr.... :)
arfinator853
23rd February 2005 23:40 UTC
I did what you said using the ReadINIStr command, but now when I compile the installer it compiles successfully, runs, but skips the custom page entirely. Only a blank dialog box comes up because I want to see if it successfully saves the data into that variable. The form doesnt even show up. Here is my function section:
Function mysql
;$0 is Host
ReadINIStr $0 mysql.ini "Field 1" outname
FunctionEnd
The mysql.ini file is up in the previous post. I found this command in the help file and didn't know what to put for "outname".
Thanks!
Arfy
arfinator853
24th February 2005 00:04 UTC
The custom page now shows up, but I dont know how I can get the data that the user enters to show up in a variable.
Here is my new functions code:
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "mysql.ini"
FunctionEnd
;Custom Page (enter mysql data)
Function mysql
;$0 is Host
!insertmacro MUI_HEADER_TEXT "MySQL Connect Options" \
"These are you MYSQL Login Details that you set when you installed MYSQL. \
If default settings were used during install, these values can be used."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "mysql.ini"
FunctionEnd
I am still going to work on the ReadINIStr thing, but I dont know if it will work.
arfinator853
24th February 2005 01:43 UTC
does anybody have any ideas?
I have gotten the script to read what is in the state field in the ini doc which would work, if only I can get it to write in the ini script the variable. (right now only plain text has worked)
Afrow UK
24th February 2005 08:55 UTC
Use !insertmacro MUI_INSTALLOPTIONS_READ $R0 "myINIFile.ini" "Field #" "State"
-Stu
Joel
24th February 2005 20:13 UTC
Also you might check INI's full path :)
Afrow UK
24th February 2005 21:42 UTC
MUI_INSTALLOPTIONS_READ will point to your myINIFile.ini that is stored in $PLUGINSDIR (which you extract to $PLUGINSDIR using MUI_INSTALLOPTIONS_EXTRACT).
No path is needed.
-Stu