M4RC II
2nd November 2005 11:32 UTC
I would make a custom page
Hy I would make a custom page for my installer.
In this custom page the user has an text field where he can write a password.
The password must be insert in an *.txt file how can i do this ?
Here is an example:
http://www.mp-filebase.de/modules/my...9516f2128f7a1f
Here you can write your steam id etc in the textfield and a script??? insert the words in the *.txt document.
How can I do this ?
Thx for your help
Afrow UK
2nd November 2005 13:49 UTC
Use InstallOptions with a Password control. There are many InstallOptions examples in NSIS\Examples\InstallOptions, and a Modern UI one NSIS\Examples\Modern UI\InstallOptions.nsi
The InstallOptions readme is under NSIS\Docs\InstallOptions
-Stu
M4RC II
2nd November 2005 16:47 UTC
Hy
Thx for your reply
I've read now all *.nsh in the example folder
But I don't know how I can make it.
So far I've made an custom page with password field.
Can anybody help me and write the code in my nsh ?
When you download my nsh there are two other files.
The Password.ini is for the custom page.
And in the users.ini must the new password.
PLS help me.
Afrow UK
2nd November 2005 18:49 UTC
You need to use ReadINIStr in the Custom Page's Leave function and read from the State of your Field #.
Then use WriteINIStr to write the value to users.ini
e.g.
Page Custom PasswordCreate PasswordLeave
LangString NoPassword ${LANG_ENGLISH} "No password entered!"
Function PasswordLeave
ReadINIStr $R0 "$PLUGINSDIR\Password.ini" "Field 3" "State"
StrCmp $R0 "" 0 +3
MessageBox MB_OK|MB_ICONSTOP $(NoPassword)
Abort
WriteINIStr "$INSTDIR\users.ini" "A Section" "A Key" $R0
FunctionEnd
-Stu
M4RC II
3rd November 2005 11:24 UTC
Hy Afrow UK thx for your help.
I've write my code now with Advanced Replace In File and 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. When I write a password in the password field my users.ini is further empty...
What is wrong ? Pls help me
JasonFriday13
9th November 2005 04:52 UTC
Try this example:
LangString NoPassword ${LANG_ENGLISH} "No password entered!"
Function PasswordLeave
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Password.ini" "Field 1" "State"
StrCmp $R0 "" 0 Password
MessageBox MB_OK|MB_ICONINFORMATION $(NoPassword)
Abort
Password:
WriteINIStr "$INSTDIR\users.ini" "A Section" "A Key" "$R0"
FunctionEnd