Archive: Input Box


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


\nsis\contrib\installoptions


/me points to HM NSIS Editor

wait! we aren't in the channel :D

A good edit will help


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!

Since is an INI file, try the INI instruction like ReadINIStr.... :)


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

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.

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)


Use !insertmacro MUI_INSTALLOPTIONS_READ $R0 "myINIFile.ini" "Field #" "State"

-Stu


Also you might check INI's full path :)


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