M4RC II
4th November 2005 13:11 UTC
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
4th November 2005 13:27 UTC
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
4th November 2005 21:38 UTC
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
5th November 2005 12:53 UTC
Please help me
If someone one know how I can do this could you write me the code in my nsi ?
kichik
5th November 2005 13:18 UTC
...
!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}
M4RC II
5th November 2005 13:46 UTC
WOW thx kichik it works