Old 28th May 2003, 19:07   #1
gek
Junior Member
 
Join Date: May 2003
Posts: 2
Two License Pages

Hi,

I'm very new to NSIS and I'm trying to figure out how to make an installer that displays 2 license pages that follow each other using Modern UI. I tried something like

code:

LicenseData "[snip long absolute path]\gpl.txt"

!insertmacro MUI_PAGECOMMAND_WELCOME
!insertmacro MUI_PAGECOMMAND_LICENSE

LicenseData "[snip long absolute path]\warning.txt"

!insertmacro MUI_PAGECOMMAND_LICENSE
!insertmacro MUI_PAGECOMMAND_DIRECTORY
!insertmacro MUI_PAGECOMMAND_STARTMENU
!insertmacro MUI_PAGECOMMAND_INSTFILES
!insertmacro MUI_PAGECOMMAND_FINISH



but it does not seem to work. Could someone help me with this issue??

One more question: Can I somehow display RTF files in the license box? It's not really necessary, but it would be nice to have.

Thanks for the great installer, btw.!!

Greets,
Daniel
gek is offline   Reply With Quote
Old 28th May 2003, 22:06   #2
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
i am not sure - this might same problem with an additional readme section which is on the to-do-list.
search the forum for "readme" and you will find no answer ;(

# i forgot
there exist a extlicense.dll or so - i found the SC on this site, but no DLL - dont know how to compile

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 28th May 2003, 22:08   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You will need to do the following:

code:

LicenseData "[snip long absolute path]\gpl.txt"

!insertmacro MUI_PAGECOMMAND_WELCOME
!insertmacro MUI_PAGECOMMAND_LICENSE
!define MUI_CUSTOMFUNCTION_LICENSE_PRE LicenseText
Page license mui.LicensePre mui.LicenseShow mui.LicenseLeave "MUI_INSTALLBUTTON_LICENSE"


Function LicenseText
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $1 $0 102 #change
SendMessage $1 ${WM_SETTEXT} 0 "STR:License Text$\r$\nLine 1$\r$\nLine 2$\r$\nLine 3" #change
FunctionEnd



You now need to get the License text on one line into the command, and you also might need to get the right dialog number (currently 102)
However, I think I have the right dialog number there?
Change the dialog number until the license text within the window changes.

-Stu
Afrow UK is offline   Reply With Quote
Old 28th May 2003, 22:15   #4
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
grmph - nice solution from the cvs i guess?
when will cvs go final

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 28th May 2003, 23:33   #5
gek
Junior Member
 
Join Date: May 2003
Posts: 2
Hi,

Thanks for your answer. I'm almost there! I now get the license page twice, but unfortunatly both time with the same license. When I compile the NSI I get the warning:

code:

1 warning:
install function "LicenseText" not referenced - zeroing code (298-301) out



I don't quite understand. Perhaps you could have a look at the script?

Thanks in advance,
Daniel
Attached Files
File Type: nsi sharpprivacy.nsi (10.4 KB, 254 views)
gek is offline   Reply With Quote
Old 28th May 2003, 23:42   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Try
!define MUI_CUSTOMFUNCTION_LICENSEPAGE_PRE LicenseText
instead of
!define MUI_CUSTOMFUNCTION_LICENSE_PRE LicenseText

-Stu
Afrow UK is offline   Reply With Quote
Old 29th May 2003, 10:02   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
FindWindow, GetDlgItem and SendMessage are all present in b3 too.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 31st May 2003, 14:55   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Re: Two License Pages

Quote:
Originally posted by gek
One more question: Can I somehow display RTF files in the license box? It's not really necessary, but it would be nice to have.
Yes, you can. Just specify an RTF file instead of a text file in LicenseData.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 31st May 2003, 17:23   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Will LicenseData ever become a non compiletime command?
I mean, so that it can be used multiple times to change the LicenseData on multiple LicensePages.

That would be a helpful feature.

-Stu
Afrow UK is offline   Reply With Quote
Old 31st May 2003, 17:27   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 10:46   #11
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
hi!

i have a similar problem...
i need to show 2 licence pages. i followed the steps (as explained in this tread), and i have 2 license pages, but with the same content (from LicenseData "txt.txt"). i have no errors or warnings. help !

thanks.
o_owd is offline   Reply With Quote
Old 2nd June 2003, 13:36   #12
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Attach the script and I'll have a look.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 13:43   #13
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
here is my script:

maybe it would be usefull to others to...
Attached Files
File Type: nsi installer.nsi (14.3 KB, 290 views)
o_owd is offline   Reply With Quote
Old 2nd June 2003, 13:54   #14
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Change:
GetDlgItem $1 $0 102 #change
to:
GetDlgItem $1 $0 1000

You will also need a way to determine that the LicenseText function was called for the right page, as it will be called for both the license pages. You should probably set a variable to 1 in the page's leave function and then if it's set in the pre function change the text and reset the variable. This way you will only see the first license when the variable is not set which is when the user comes back from the second page to the first page. I'm assuming here that the two pages come right after the other, as in your script. If this is not the case anymore you will have to set the variable in other pages too to know which page you should show next.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 14:26   #15
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
i changed "GetDlgItem $1 $0 102 #change" with "GetDlgItem $1 $0 1000" but i still have 2 pages with the text from LicenseData displayed.

thanks.
o_owd is offline   Reply With Quote
Old 2nd June 2003, 14:31   #16
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Hmm... Right. The window hasn't been created yet. You should use it in the show function not the pre function.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 15:20   #17
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
a little help please!

where to put the variable ? in what section ? i must create a new one ?
and in what section to check the state of the variable, and change it ?

and the most important !
how do i declare one ?

thanks.
o_owd is offline   Reply With Quote
Old 2nd June 2003, 15:26   #18
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Not a section, in the pre/show/leave functions of the pages. You don't need to declare one, just use $0, $1, ..., or $R9. This variable is meant for the LicenseText function to know in which page it is so it won't show the same text on both pages. In your case setting it on the leave function of the license page and clearing (and checking) it in the show function should be enough.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 15:47   #19
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
sorry. i do not understand.

maybe with an example ? a little one ?
o_owd is offline   Reply With Quote
Old 2nd June 2003, 15:57   #20
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
I have used the same pre, show and leave functions for both of the license pages because that's how it works with the MUI.
Attached Files
File Type: nsi bla.nsi (668 Bytes, 223 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 2nd June 2003, 16:12   #21
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
i will try tonight. thanks very much. i'll tell you tomorow the result.
thanks again.
o_owd is offline   Reply With Quote
Old 3rd June 2003, 12:30   #22
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
hi!

i tried and tried and finaly it works. but one big question:
the first license page displayes "LicenseData" while for the second one i have to write manualy in the script every line. but what if i have a license about 10KB ? is it posible to display in the second page too, the license from a file ?

thanks again!
o_owd is offline   Reply With Quote
Old 3rd June 2003, 12:57   #23
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Use this instead of the SendMessage ${WM_SETTEXT} command:

code:
SendMessage $0 ${WM_SETTEXT} 0 "STR:"
FileOpen $1 "$PLUGINSDIR\secondlicense.txt" "r"
loop:
FileRead $1 $2
SendMessage $0 0x00C2 0 "STR:$2"
IfErrors 0 loop
FileClose $1
SendMessage $0 0x00B1 0 0
SendMessage $0 0x00B7 0 0


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 3rd June 2003, 13:41   #24
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
it works. thanks.

then it should work for 3 licenses too ?
o_owd is offline   Reply With Quote
Old 3rd June 2003, 13:53   #25
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
If you apply the right checking in the show and leave functions. It shouldn't be too hard, just keep in mind that the leave function is only called when the user clicks next and not on back or cancel.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 3rd June 2003, 14:54   #26
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
@kichik

same problem here - i have no idea - not familiar with this:
code:
!include WinMessages.nsh

;--------------------------------
;Modern UI Configuration

!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_LICENSE
!define MUI_LICENSEPAGE_CHECKBOX
Page license "" "showLicense" "leaveLicense"

!insertmacro MUI_PAGE_COMPONENTS
!define MUI_COMPONENTSPAGE_SMALLDESC

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED "$INSTDIR\readme.txt"

!define MUI_ABORTWARNING

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Data

LicenseData "license.txt"

;--------------------------------
;Reserve Files

ReserveFile "readme.txt"

;--------------------------------
;Installer Functions

Function showLicense
StrCmp $R9 1 0 skip
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000

SendMessage $0 ${WM_SETTEXT} 0 "STR:"
FileOpen $1 "readme.txt" "r"
loop:
FileRead $1 $2
SendMessage $0 0x00C2 0 "STR:$2"
IfErrors 0 loop
FileClose $1
SendMessage $0 0x00B1 0 0
SendMessage $0 0x00B7 0 0

skip:
StrCpy $R9 0
FunctionEnd

Function leaveLicense
StrCpy $R9 1
FunctionEnd

;--------------------------------



I get twice the License-Page with nail [x] and when i reached the compo-page and step one step back i get my readme in a small (license) window and a nail. step back once more and repeat from license page same procedure.



##
second problem - i get no option for the readme at the end. cvs-problem? 2b3 did so. Or just again the MUI?

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 3rd June 2003, 15:02   #27
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
try changing like this:

FileOpen $1 "readme.txt" "r" to FileOpen $1 "$PLUGINSDIR\readme.txt" "r"

and you must have this:

Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\readme.txt "readme.txt"
FunctionEnd

hope it will help
o_owd is offline   Reply With Quote
Old 3rd June 2003, 15:29   #28
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
for kichik,

i tried (for the 3rd license page) but no result.
so for the moment it will remain so.
o_owd is offline   Reply With Quote
Old 3rd June 2003, 18:28   #29
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Can you attach the script?
Joost Verburg is offline   Reply With Quote
Old 3rd June 2003, 18:41   #30
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Brummelchen, please attach large scripts from now on. o_owd answer is correct, you have to extract the file first and use full path.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 3rd June 2003, 21:31   #31
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
for Joost:

Quote:
Can you attach the script?
this question was for me? or Brummelchen?
o_owd is offline   Reply With Quote
Old 3rd June 2003, 21:51   #32
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
does not work so far

After MUI_PAGE_WELCOME

MUI_PAGE_LICENSE
image
Page license "" "showLicense" "leaveLicense"
image
MUI_PAGE_COMPONENTS
image
then back to Page license
image

and so on ...

i always get the correct readme when i step back.

script is attached so far (sorry for inconvenience)
Attached Files
File Type: zip test.zip (3.8 KB, 168 views)

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 4th June 2003, 06:48   #33
o_owd
Senior Member
 
o_owd's Avatar
 
Join Date: Feb 2003
Location: TGM, Romania
Posts: 176
Send a message via ICQ to o_owd Send a message via Yahoo to o_owd
i don't know why it does not display the borh license pages.

try with this script. (it works in my script)
Attached Files
File Type: nsi test.nsi (3.1 KB, 207 views)
o_owd is offline   Reply With Quote
Old 4th June 2003, 16:19   #34
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
Greta move - u da man

it works. i have made a little change to get different pageheaders

> Page license "" "showLicense" "leaveLicense"
> Page license "" "showLicense1" "leaveLicense"

but one little teardrop

> !define MUI_LICENSEPAGE_CHECKBOX

no checkbox so far

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 4th June 2003, 20:35   #35
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Brummelchen, you have to use the MUI macros all the way if you are using the MUI. Using Page as a replacment for the MUI_PAGE_LICENSE macro is what causing you all of the problems above.

o_owd, please attach the script, or describe the logic you've tried to include 3 license pages.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 4th June 2003, 20:58   #36
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
@kichik

> !define MUI_LICENSEPAGE_CHECKBOX

exist there a MUI macro for that?

> or describe the logic you've tried to include 3 license pages.

I made an example to this, i hope that helps - it is based on the script from o_owd

The MUI section must be like this

> Page license "" "showLicense" "leaveLicense"
> Page license "" "showLicense1" "leaveLicense"
> Page license "" "showLicense2" "leaveLicense"
...

the first function is reduced 'cause it only displays the normal license.txt
Attached Files
File Type: nsi test2.nsi (2.4 KB, 194 views)

Greets, Brummelchen
Brummelchen is offline   Reply With Quote
Old 4th June 2003, 21:02   #37
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
No, "Using Page as a replacment for the MUI_PAGE_LICENSE macro is what causing you all of the problems above. "

MUI_LICENSEPAGE_CHECKBOX is a MUI define and is OK, but worth nothing if you don't use the MUI macro to insert the license page.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 4th June 2003, 21:25   #38
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
@kichik

So there is no alternative for that? Not a problem at all - the checkbox is only preventing from "klick - klick - klick - installed" must be "klick - read - check - klick - installed"
But the other way dont work.

Is it possible to get the checkbox additional from InstallOption?

Greets, Brummelchen

Last edited by Brummelchen; 4th June 2003 at 22:27.
Brummelchen is offline   Reply With Quote
Old 4th June 2003, 21:42   #39
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The other way is the only right way and it can work, you only need to find the right logic to make it show the right license in the right page. The logic implemented in my examples works for two pages that come one after the other. If you have another case you'd have to find another logic and implement it.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 4th June 2003, 22:29   #40
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
>> you only need to find the right logic to make it show the right license in the right page. The logic implemented in my examples works for two pages that come one after the other.

Thats what i am doing to - Welcome/license/readme
but so far i have no check button only the "accept" button.

to prevent misunderstandings...
you have a solution for that (2pages with check button) or not?

Greets, Brummelchen
Brummelchen 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