- NSIS Discussion
- Username Password +More
Archive: Username Password +More
KHolmes
5th May 2003 16:57 UTC
Username Password +More
Hello,
I know there is code out there for a username and password.. I have found a few on this board.
Is this possible. I have 3 different programs I want installed. User1 enters username1 password1 can then proceed to install program1, user2 enters username2 and password2 can install program2, user3 enters username3 and password3 can then proceed to install program3. I could make 3 different installers and 3 different discs, but that's not what I really want. If someoen could modify the code below and repost it. That would be greatly appreciated by myself and anyone else who can use it
Thanks in advance
[edit]edited by kichik. please don't paste in huge scripts. script in question can be found @ http://nsis.sourceforge.net/archive/...instances=0,64[/edit]
Afrow UK
5th May 2003 19:18 UTC
Why can't you just do what you have there, but just extract different files depending on the entered password / user name.
-Stu
Joost Verburg
5th May 2003 20:05 UTC
You can save a value to a variable and use it to install different files in the section.
KHolmes
6th May 2003 01:06 UTC
Can you do this?
Joost could you modify your code so it would do this? I am not that well versed in nsi scripts.
Please and Thank You
Joost Verburg
6th May 2003 12:30 UTC
Just what you did in the page function, you can also put that in a section (read the INI file again or store the values in a variable).
KHolmes
7th May 2003 22:55 UTC
Joost I need your help
Joost I am really new to programming and scripting.. I could really use your help on howto figure out how to get these into a variable and how each can call their own files to install... I am hoping to study and learn off what you have done, but I just don't have the knowledge to continue from here..
Can you please help me...
Thanks
Ken
KHolmes
9th May 2003 02:50 UTC
Can anyone help me!
Can someone please help me. I am new to programming and scripting.
Joost Verburg
9th May 2003 09:01 UTC
Check 'Examples\Modern UI\InstallOptions.nsi' or 'Contrib\InstallOptions\test.nsi', they use the input of a custom page.
Sunjammer
9th May 2003 09:31 UTC
Here's a way of doing it, but I'd prefer being able to do it by turning sections on and off (yet still have them invisible) rather than testing a variable in each section. Still, it seems to work okay.
(Note: it's a variation on the script KiCHiK linked to at the top of this page, so it needs the .ini file that goes with that script, follow his link to find the ini file)
kichik
9th May 2003 13:01 UTC
Sunjammer, in the latest CVS version (maybe even b3, I don't remember right now) you can unselect hidden sections so they won't get executed. I have attached a small example script.
Sunjammer
9th May 2003 13:24 UTC
Yeah, I've just never played with that stuff, and figured any kind of solution would be of interest to KHolmes. I was actually going to hold back but then thought "hmm he/she's been waiting for a while already" ... :D
KHolmes
10th May 2003 02:34 UTC
Works, but doesn't do what I want
I can get it to run, but it let's user2 install user1's file etc... I don't want user2 to be able to choose user1's file just their own file.
This is what I have.. Is what I am asking possible?
Section "user1" user1
DetailPrint "user1 section"
StrCmp $R9 "user1" 0
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "file1.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd
Section "user2" user2
DetailPrint "user2 section"
StrCmp $R9 "user2" 0 skip
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "user2.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd
Section "user3" user3
DetailPrint "user3 section"
StrCmp $R9 "user3" 0 skip
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "user3.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd
Anyone got any ideas?
Thanks
Sunjammer
10th May 2003 11:12 UTC
I don't understand, it works fine for me. If I "login" as user2 then the only files it installs are the files in the section for user2. The DetailPrint output shows on my screen :-
User name: user2
Password: user2 password
user1 section
user2 section
install files
Extract: NSIS.exe
user3 section
Completed
Now obviously I just set some arbitrary files to install but nsis.exe was the file for user2, it didn't install any of the files I had in the other sections so what is it that doesn't work for you?
kichik
10th May 2003 11:12 UTC
Put back the minuses before the section name. If the name is "-user1" the section won't show as a component on the components page and the user won't be able to deselect it, although it will still not install because of the check.
Sunjammer
10th May 2003 11:13 UTC
Ahha I didn't spot that, nice one KiCHiK.
KHolmes
10th May 2003 12:31 UTC
Got it to work
OK I got it to work...
Thanks for all your guys' help.. I really appreciate it..
Here is the modified version for anyone who is new to NSI. I added a few more comments for the ultra newb like myself..
The up.ini file can be found at the link that Kichik added above.
Thanks again everyone
KHolmes
10th May 2003 12:45 UTC
P.S. If you use this
If you use this script post a reply here. It's always nice to give a kudos to the people who wrote it.
KHolmes
11th May 2003 02:52 UTC
Just a quick question. How do you get rid of the prompt that comes up that gives you the username and password?
Never mind.. I opened my eyes and saw this
MessageBox MB_OK "user [$0] pass [$1]"
Joel
11th May 2003 03:15 UTC
I think because is:
MessageBox MB_OK "user $0 pass $1"
; change this line in your script