Skip to content
⌘ NSIS Forum Archive

Reading Custom Page

5 posts

backpacker299#

Reading Custom Page

I have searched many places and tried different ways to read from a custom page, but things still do not work. I am looking for some help. Here are the relevant code shown in oder of processing (things exist in different, included, files)

Var Database_Server ; Database server location
Var Database_Database ; Database to use
Var Database_Username ; Username to connect with
Var Database_Password ; Password to connect with

#----- PreDsnPage
# Prepare the DSN custom page for action
Function PreDsnPage

!insertmacro MUI_HEADER_TEXT "Liebert Autotest Suite Setup" "ODBC Datasource Configuration"
!insertmacro INSTALLOPTIONS_DISPLAY "DSN.ini"

FunctionEnd

#----- PostDsnPage
# Copy the data entered on the DSN custom page.
Function PostDsnPage

ReadINIStr $Database_Server "DSN.ini" "Field 5" "State"
ReadINIStr $Database_Database "DSN.ini" "Field 6" "State"
ReadINIStr $Database_Username "DSN.ini" "Field 8" "State"
ReadINIStr $Database_Password "DSN.ini" "Field 9" "State"

MessageBox MB_OK "Server: $Database_Server"
MessageBox MB_OK "Database: $Database_Database"
MessageBox MB_OK "Username: $Database_Username"
MessageBox MB_OK "Password: $Database_Password"

FunctionEnd

#----- .onInit
# Verifies that LAS is not already installed and then copies
# default directory locations to variables
Function .onInit

...

#----- Extract the Datasource custom page file
!insertmacro INSTALLOPTIONS_EXTRACT "DSN.ini"

FunctionEnd

The message boxes that I have to display the input display blanks.

Thanks in advance for any and all help.
Red Wine#
ReadINIStr... but where is that ini? Is it extracted properly into pluginsdir?
If so you should add:
ReadINIStr $Database_Server "$PLUGINSDIR\DSN.ini" "Field 5" "State"
bholliger#
Re: Reading Custom Page

Hi there!

I'd suggest using


ReadINIStr $Database_Username "$PLUGINSDIR\DSN.ini" "Field 8" "State"
or


!insertmacro INSTALLOPTIONS_READ $Database_Username "DSN.ini" "Field 8" "State"
Use whatever you like best.

Cheers

Bruno