Archive: Password - again


Password - again
Hi.
I have created a simple installer, but I need to add a page so that the user has to enter a password.

I have searched in the forum and I have found multiple answer to this same question.
My problem is that all these make a reference to InstallOptions and Custom Pages and to me it sounds very complicated.

Note: I *had* to use HM NIS Edit to create a script because I am not a programmer and even if I spent time on the script and the manual I could not understand a word of it (or almost).

Now I believe that I understand a bit more and I have edited my script manually, but still my level is very poor.
Therefore, I do not understand, for example, where I have to save the up.ini or up.nsi and which lines from the up.nsi (and other examples) I can insert in my original script and where.

If anyone has the time to write me a step by step instruction I will appreciate that.
It would be ok for me to send the script by email if necessary.

Sorry for the long post.
Regards,
Blurred


Have you checked the InstallOptions examples both in Contrib\InstallOptions and Examples?

-Stu


Yes - Confused
Hi AFrow UK,
I had a look at those examples and at the examples in the forum.
The main issue is that I ma not a programmer, therefore it is difficult for me to understand the examples if they are not VERY easy.

Anyway, I will try again today.
One question: my understanding is that in the main nsis script (.nsi) I add a custom page and then, using the .ini I define how my custom page will look like. Is this correct?
Another question is: which is the line that I have to insert in my nsis script (.nsi) to point it to the approrpiate .ini file?
For example, I would like to keep the .ini in "My document/project 1" and not within a subfolder of "program files/nsis/...". How do I do that?

Thanks in advance for your help and sorry if my questions are very silly :(

Blurred


You need to compress the ini file and extract it to a suitable folder on run-time.

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "$%USERPROFILE%\My Documents\project 1\ioFile.ini" "ioFile.ini"
FunctionEnd
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Install Options Page Title"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "A subtitle"

Function FunctionName ;FunctionName defined with Page command
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioFile.ini"
FunctionEnd


(From Modern UI readme)

-Stu

I'm trying to do the same thing... and I tried following the readme's example. But for some reason nothing happens when I click the NEXT button. Seems like having an input box screws it up and makes things more complicated (the button works without the input box). Any ideas? Thanks.


here is a example based on the archive info

www.emeraldcpu.com/zman3/script.zip

the password or serial is 123456789


well i tried copying parts of that script over... and it still doesn't work. can someone check my code please... after staring at it for the past 5 hours i'm probably not gonna see the mistake. thanks!


[...]
;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
Page custom PWEnter PWExit ; <- this is the custom page
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU "Application" $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
[...]
;--------------------------------
;Reserve Files

; ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "password.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
[...]
;--------------------------------
;Installer Functions

Function .onInit

; InitPluginsDir
; File /oname=$PLUGINSDIR\password.ini "password.ini"

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "password.ini"

SetOutPath $TEMP1 ; <- next 4 lines: splash image
File /oname=spltmp.bmp "splash.bmp"
advsplash::show 2000 600 400 -1 $TEMP1\spltmp
Delete $TEMP1\spltmp.bmp

FunctionEnd

LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Installation Password"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Enter your password to continue the installing ${MUI_SYSNAME}."

Function PWEnter

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "password.ini"
; InstallOptions::dialog "$PLUGINSDIR\password.ini"

FunctionEnd

Function PWExit

Quit ; <- this function is never reached (it just doesn't quit)

FunctionEnd

after another 2 hours i discovered the problem... i had to set minlength to 0 in the ini file. thanks for your help anyways!