Skip to content
⌘ NSIS Forum Archive

What is wrong with my code?

6 posts

M4RC II#

What is wrong with my code?

Hy I've make (with the help of afrow uk) a custom page where the user can write an password. This password must insered in an file.

This is my code:


LangString NoPassword ${LANG_ENGLISH} "No password entered!"

Function PasswordLeave

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Password.ini" "Field 1" "State"
StrCmp $R0 "" 0 +9
Push "Password" #-- text to be replaced within the " "
Push "$R0" #-- replace with anything within the " "
Push all #-- replace all occurrences
Push all #-- replace all occurrences
Push $INSTDIR\users.ini #-- file to replace in
Call AdvReplaceInFile #-- Call the Function
MessageBox MB_OK|MB_ICONINFORMATION $(NoPassword)
Abort

FunctionEnd
But it doesn't work.

What is wrong?

Please help me.

Here is my *.nsi
kichik#
You've got StrCmp backwards. It's skipping the code if the user has entered has a password, instead of the other way around. You should use the LogicLib:
!include LogicLib.nsh
# ...
${If} $R0 == ""
MessageBox MB_OK blah
${Else}
Call Adva...
${EndIf}
M4RC II#
hy kichik thx for your help but I don't understand what I must write now in my *.nsi

Could you write please the code in my password.nsi?


Marc
M4RC II#
Please help me

If someone one know how I can do this could you write me the code in my nsi ?
kichik#
...
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Password.ini" "Field 1" "State"
${If} $R0 != ""
Push "Password" #-- text to be replaced within the " "
Push "$R0" #-- replace with anything within the " "
Push all #-- replace all occurrences
Push all #-- replace all occurrences
Push $INSTDIR\users.ini #-- file to replace in
Call AdvReplaceInFile #-- Call the Function
${Else}
MessageBox MB_OK|MB_ICONINFORMATION $(NoPassword)
Abort
${EndIf}