Old 8th December 2004, 10:22   #1
manyoka
Junior Member
 
Join Date: Dec 2004
Location: Jo-burg.South Africa
Posts: 14
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
manyoka is offline   Reply With Quote
Old 8th December 2004, 10:46   #2
bgosalci
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 8th December 2004, 10:59   #3
bgosalci
Junior Member
 
Join Date: Dec 2004
Posts: 17
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.
bgosalci is offline   Reply With Quote
Old 8th December 2004, 11:45   #4
manyoka
Junior Member
 
Join Date: Dec 2004
Location: Jo-burg.South Africa
Posts: 14
Yes please that would be great.

Much appreciated.
Thanx
manyoka is offline   Reply With Quote
Old 8th December 2004, 13:30   #5
bgosalci
Junior Member
 
Join Date: Dec 2004
Posts: 17
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
bgosalci is offline   Reply With Quote
Old 8th December 2004, 13:33   #6
RobGrant
Senior Member
 
Join Date: Sep 2004
Location: Nottingham
Posts: 263
Mate, attach it as a file
RobGrant is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump