Old 7th November 2006, 01:32   #1
bigkahuna
Junior Member
 
Join Date: Nov 2006
Posts: 3
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??

code:
;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

bigkahuna is offline   Reply With Quote
Old 7th November 2006, 08:47   #2
bholliger
Senior Member
 
Join Date: Jul 2004
Location: Switzerland
Posts: 223
Hi bigkahuna!

I've just added some sample code:

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

Hope this helps!

Have a nice day.

Bruno
bholliger is offline   Reply With Quote
Old 7th November 2006, 10:44   #3
bigkahuna
Junior Member
 
Join Date: Nov 2006
Posts: 3
Yes that helped a lot. Thank you very much!!!
bigkahuna is offline   Reply With Quote
Old 7th November 2006, 19:55   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
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.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 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