Archive: Help Noob with custom license.txt?


Help Noob with custom license.txt?
Hi all,

This is my first project with NSIS, and I have a super easy first install to complete. The only problem I've run into is that the license.txt must be less than 1024 characters and mine is over 9000. I searched the forum for answers and read about the custom license plugin and installed it. But now I can't figure out how to make it work in my script. Here's my script so far, can anyone help??

;NSIS Modern User Interface
;Start Menu Folder Selection Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

;Name and file
Name "ROVsim Demo"
OutFile "ROVsimDemoInstall.exe"

;Default installation folder
InstallDir "$PROGRAMFILES\ROVsimDemo"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\ROVsimDemo" ""

;--------------------------------
;Variables

Var MUI_TEMP
Var STARTMENU_FOLDER

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY

;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\ROVsimDemo"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"

!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...
File "ROVsim Demo.exe"
File "readme.pdf"

;Store installation folder
WriteRegStr HKCU "Software\ROVsimDemo" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\ROVsim Demo.lnk" "$INSTDIR\ROVsim Demo.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Readme.lnk" "$INSTDIR\readme.pdf"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\ROVsim Demo.exe"
Delete "$INSTDIR\readme.pdf"
Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

Delete "$SMPROGRAMS\$MUI_TEMP\ROVsim Demo.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Readme.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"

;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:

DeleteRegKey /ifempty HKCU "Software\ROVsimDemo"

SectionEnd

Hi bigkahuna!

I've just added some sample code:

http://nsis.sourceforge.net/CustomLicense_plug-in

Hope this helps!

Have a nice day.

Bruno


Yes that helped a lot. Thank you very much!!!


Thanks for adding a sample to my page. It never crossed my mind when I uploaded it a few months ago. Will be updated soon.