Archive: Displaying files


Displaying files
In my first foray into NSIS (and installers in general) I have almost finished my very first installer, but the last step is causing me some serious headaches. I would like to read in a file (e.g. Release Notes or Change Log) and display that as the last page of the installer. It's working (sorta), but the file is over 2K in size. Registers only hold 1K, so I'm filling registers as the file is read, but the control element on the screen also only holds 1K. I thought about using the License page, but it has that "I Agree" button on it. Any (better/alternate) ideas?

Thanks!
Mitch


Here's the code so far:


; ---------------------------
; header stuff here...
; ---------------------------

Page instfiles
Page custom PageReleaseNotes "" ""

; ------------------------------------------------------------------
; Reads in the Release Notes and displays at end of installtion

Var Dialog
Function PageReleaseNotes
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}

StrCpy $R1 ""
StrCpy $R2 ""

ClearErrors
StrCpy $R0 "Release Notes$\r$\n"

StrCpy $9 0
FileOpen $1 "$INSTDIR\icw\release_notes.txt" r
IfErrors ReadErr

ReadLoop:
FileRead $1 $2
IfErrors LoopErr

StrLen $5 $R0
${If} $5 >= 1000 ;; we're about to exceed register capacity
StrLen $5 $R1
${If} $5 > 0
StrCpy $R2 $R0
${Else}
StrCpy $R1 $R0
${EndIf}
StrCpy $R0 ""
${EndIf}
StrCpy $4 $R0
StrCpy $R0 "$4 $\r$\n $2"
IntOp $9 $9 + 1

GoTo ReadLoop

LoopErr:
StrCpy $4 $R0 ; make sure we grab that last line read in
StrCpy $R0 "$4 $\r$\n $2"

FileClose $1
ReadErr:

nsDialogs::CreateControl /NOUNLOAD ${__NSD_Text_CLASS} \
${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_MULTILINE}|${WS_VSCROLL} \
${__NSD_Text_EXSTYLE} 0 0 100% 100% "$R1 $R2 $R3"
Pop $0

; Display the dialog
nsDialogs::Show
FunctionEnd

You could use this:
http://nsis.sourceforge.net/CustomLicense_plug-in

Stu


Also you may want to try this script...

http://nsis.sourceforge.net/Readme_P...I_License_Page


Thanks for suggesting my plugin. Here is the other "half": http://nsis.sourceforge.net/External_License_file