- NSIS Discussion
- Activation page component
Archive: Activation page component
chris_svp
2nd January 2004 11:38 UTC
Activation page component
Hi all,
my boss want to add a registration step (like in a good commercial software he said :))during installation, so I think I add to create some kind of activation page between MUI_PAGE_LICENSE and MUI_PAGE_DIRECTORY:
----------------------------------
|Registration X|
----------------------------------
| |
| Name: |
| Company: |
| Serial Number: |
| |
| OK Cancel |
----------------------------------
What am I wondering is
- someone has already done that ?
- and more generally if there is a location (other than the examples directory of course) to find scripts that provide a new functionnality in open source?
I am using the MUI.
thanks a lot guys
kichik
2nd January 2004 12:24 UTC
The Contrib folder contains examples for the plug-ins. Among those plug-ins is InstallOptions which is exactly what you need. Examples\Modern UI\InstallOptions.nsi is also an InstallOptions example.
chris_svp
2nd January 2004 14:22 UTC
thanks, I missed this tuto (the name is not very correlated...)
My second question is still interrogating me :)
It would be very nice if such a location exists
kichik
2nd January 2004 14:30 UTC
Well, that's the Contrib folder. There is also The Archive.
chris_svp
2nd January 2004 15:00 UTC
ah ok :)
I have another -silly- question, this time on the custom page I create: how do I do multilingual pages?
I mean how do I, for example, decide the caption of a label in function of the user selected language?
thanks for your ultra fast answers
kichik
2nd January 2004 15:02 UTC
Write a LangString to the INI using WriteINIStr or the MUI macro (MUI_INSTALLOPTIONS_WRITE, I think).
chris_svp
2nd January 2004 15:31 UTC
could you be more specific please?
for example, taking ioB.ini, how do I put a multilingual text for the label?
//////ioB.ini//////////
[Settings]
NumFields=1
[Field 1]
Type=label
Text=Install Options Page B
Left=0
Right=-1
Top=0
Bottom=10
////////////////////////
I tried Text=LangString ${LANG_ENGLISH} "Install Page B"
but this doesnot work.
I believe I misunderstand your answer :(
chris_svp
2nd January 2004 15:33 UTC
oh my god I did a mistake in typing the msg:
I tried
Text=LangString ${LANG_ENGLISH} "Install Page B"
Text=LangString ${LANG_FRENCH} "Page d'installation B"
kichik
2nd January 2004 15:37 UTC
You need to write it using WriteINIStr or the MUI macro on runtime. That is, before you show the page, before you call InstallOptions to parse the INI, write the LangString into the text/state field.
WriteINIStr $PLUGINSDIR\mypage.ini "Field 4" "Text" "$(MyLangString)"
jamesgoh
27th January 2004 01:31 UTC
I have managed to add in the serial code checking. But I have 2 questions:
(1) The serial code page can still be skipped when the installer is executed in DOS using the /S switch. How do I overcome that?
(2) I authenticate the serial code using the StrCmp instruction. But StrCmp is non-case sensitive. How do I make a case sensitive comparison?
Please advice.
Vytautas
27th January 2004 02:20 UTC
To use a case sensitive comparison you will have to use the system plugin with the appropriate API call or alternatively write a plugin for NSIS.
Vytautas
opher
27th January 2004 08:29 UTC
As to silent (/S switch) run, you can place code in .onInit to check for (= require) the serial code on the command line or otherwise emit a warning and exit.
chris_svp
4th February 2004 10:25 UTC
Originally posted by jamesgoh
I have managed to add in the serial code checking.
Can I ask you how you did?
My problem is that I do not know how to catch the NextButton click (i.e I do not know where to put my code for the checking).
Vytautas
4th February 2004 11:25 UTC
Check the documentation about the leave function you can define for any page in NSIS. You should place your check in that function and if the serial is incorrect use the abort command to prevent the installer from advancing to the next page.
Vytautas ;)
Joost Verburg
4th February 2004 11:33 UTC
You can disable the Next button if the serial is invalid using EnableWindow, but that alone is not very secure. Therefore you should also check the serial again in the leave funtion and Abort if the serial is invalid.
chris_svp
4th February 2004 13:46 UTC
thanks guys for your quick answers, it helped me a lot (I just missed the leave_function parameter of the Page function). :)
Now, I have another problem which is the dynamic update of my page (i.e write the registration code after the user click on Generate)
I join my scripts to this post with a #FIXME in activ.nsi at the place where I want to add this stuff.
I think that I should use SendMessage but my tries in this area stay unsuccessful.:(
Thanks again for the previous help.
kichik
4th February 2004 14:04 UTC
You need to use SendMessage <hwnd> ${WM_SETTEXT} 0 "STR:$1". To get the hwnd use GetDlgItem along with the hwnd of the InstallOptions dialog. To get the hwnd of the InstallOptions dialog see the example to set InstallOptions font in the MUI readme.
chris_svp
4th February 2004 16:22 UTC
thank you very much, this is perfectly working now :)