Old 2nd November 2005, 10:32   #1
M4RC II
Junior Member
 
Join Date: Oct 2005
Posts: 21
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
M4RC II is offline   Reply With Quote
Old 2nd November 2005, 12:49   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 2nd November 2005, 15:47   #3
M4RC II
Junior Member
 
Join Date: Oct 2005
Posts: 21
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.
Attached Files
File Type: rar pls help me.rar (1.3 KB, 292 views)
M4RC II is offline   Reply With Quote
Old 2nd November 2005, 17:49   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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.
code:
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
Afrow UK is offline   Reply With Quote
Old 3rd November 2005, 10:24   #5
M4RC II
Junior Member
 
Join Date: Oct 2005
Posts: 21
Hy Afrow UK thx for your help.

I've write my code now with Advanced Replace In File and this is my code:

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
Attached Files
File Type: rar password.rar (2.0 KB, 281 views)
M4RC II is offline   Reply With Quote
Old 9th November 2005, 03:52   #6
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Try this example:
code:
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


"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 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