Help me
Hi everyone I am still battling to just create a simple dialog to get a user to input his password for SQL,without using INI.Files.If anyone has a script can u please reply.
Thank You
Matt
Archive: Help me
Help me
Hi everyone I am still battling to just create a simple dialog to get a user to input his password for SQL,without using INI.Files.If anyone has a script can u please reply.
Thank You
Matt
why not use INI files, I have done the same thing as you, ask user for DB password. If you are intereseted i can post the code.
Ha installer that I am working on at the moment does the similar staf as yours. I am installing MSDE and asking the user to provide the password for "sa" DB owner as well as for the DB user. I have used INI files, and it is working fine.
Yes please that would be great.
Much appreciated.
Thanx
Ok, here is the INI file that asks the user for input:
[Settings]
NumFields=4
Title="Configuration"
[Field 1]
Type=Label
Left=0
Right=-1
Top=0
Bottom=8
Text="Please provide the password for Database user"
[Field 2]
Type=Text
Left=0
Right=60
Top=10
Bottom=25
State=""
Flags=PASSWORD
[Field 3]
Type=Label
Left=0
Right=-1
Top=35
Bottom=43
Text="Please re-enter the password"
[Field 4]
Type=Text
Left=0
Right=60
Top=45
Bottom=60
State=""
Flags=PASSWORD
And the script:
;---------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;General
;Name and file
Name "Test"
OutFile "test.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\LocalAlert"
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_ABORTWARNING
!define APP_NAME "Test"
;--------------------------------
;Variables
Var DBpassword
Var DBpasswordAgain
;--------------------------------
;Pages
Page custom DBUserPassword ValidateDBUserPassword
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
BrandingText "© Test Installer"
;--------------------------------
;Reserve Files
;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
ReserveFile "db_info.ini"
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
Section
MessageBox MB_ICONEXCLAMATION|MB_OK "Test installer that shows how to get user inputs$\n$\n\
Password = $DBpassword"
SectionEnd
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Database user password"
Function DBUserPassword
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" ""
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "db_info.ini"
FunctionEnd
Function ValidateDBUserPassword
;Read a value from an InstallOptions INI file
!insertmacro MUI_INSTALLOPTIONS_READ $DBpassword "db_info.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $DBpasswordAgain "db_info.ini" "Field 4" "State"
StrCmp $DBpassword "" noInput1 var1OK
var1OK:
StrCmp $DBpasswordAgain "" noInput2 var2OK
var2OK:
StrCmp $DBpassword $DBpasswordAgain done notSame
noInput1:
MessageBox MB_ICONEXCLAMATION|MB_OK "No password entered$\n$\nPlease enter the password for Database user, in order to continue"
Abort
noInput2:
MessageBox MB_ICONEXCLAMATION|MB_OK "No password re-entered$\n$\nPlease re-enter the password for Database user, in order to continue"
Abort
notSame:
MessageBox MB_ICONEXCLAMATION|MB_OK "Both entries must be the same value, in order to continue"
Abort
done:
FunctionEnd
Function .onInit
;Extract InstallOptions INI files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "tomcat_info.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "smtp_info.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "db_info.ini"
FunctionEnd
Mate, attach it as a file :)