Archive: NSIS Noob question!


NSIS Noob question!
I pieced this script together from examples I found in various locations. It now does just about everything I want to do with 2 exceptions:

- The publisher's name and file size do not appear in the control panel's "Programs and Features" list. How do I get these to show?

- I've seen a check box during install which allows me to uncheck the mail program's name, which of course I wouldn't do. But how to I get the desktop shortcut and the start menu shortcuts to also become optional?

Thanks, Bill



; QuikWAS.nsi

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

; The name of the installer
Name "QuickWAS"

; The file to write
OutFile "QuickSetup.exe"

; The default installation directory
InstallDir $PROGRAMFILES\QuickWAS

; Request application privileges for Windows Vista
RequestExecutionLevel admin


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

; Pages

Page components
Page directory
Page instfiles
; Page license

UninstPage uninstConfirm
UninstPage instfiles

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

; The stuff to install
Section "QuickWAS"

; SectionIn RO

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File "QuickWAS.exe"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QuickWAS" "DisplayName" "QuickWAS"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QuickWAS" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QuickWAS" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QuickWAS" "NoRepair" 1
WriteUninstaller "uninstall.exe"

; SectionEnd

; Section "install" Installation info

;create desktop shortcut
CreateShortCut "$DESKTOP\QuickWAS.lnk" "$INSTDIR\QuickWAS.exe" ""

;create start-menu items
CreateDirectory "$SMPROGRAMS\QuickWAS"
CreateShortCut "$SMPROGRAMS\QuickWAS\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\QuickWAS\QuickWAS.lnk" "$INSTDIR\QuickWAS.exe" "" "$INSTDIR\QuickWAS.exe" 0


SectionEnd

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

Section "Uninstall"

; Remove registry keys
DeleteRegKey HKCU "Software\AA4M Software"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QuickWAS"

; Remove files and uninstaller
Delete $DESKTOP\QuickWAS.lnk
Delete $INSTDIR\QuickWAS.exe
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\*.was

; Remove shortcuts, if any
Delete "$SMPROGRAMS\QuickWAS\*.*"

; Remove directories used
RMDir "$SMPROGRAMS\QuickWAS"
RMDir "$INSTDIR"

SectionEnd

Please use http://nsis.pastebin.com to paste large amounts of code.

You can create a custom page to show checkboxes. See the nsDialogs readme.

Try searching for 'add remove programs' to get info on the registry keys you need to set to add publisher name.


I've just spend 3 days (on and off) digging into the documentation and now have everything doing exactly what I want with only one exception. This is that the desktop icon still doesn't appear as an option with a checkbox, but the start menu words as expected. So how do I get the desktop icon to be an optional install for the user?

Thanks, Bill

Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\QuickWAS"
CreateShortCut "$DESKTOP\QuickWAS.lnk" "$INSTDIR\QuickWAS.exe" "" "$INSTDIR\QuickWAS.exe" 0
CreateShortCut "$SMPROGRAMS\QuickWAS\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\QuickWAS\QuickWAS.lnk" "$INSTDIR\QuickWAS.exe" "" "$INSTDIR\QuickWAS.exe" 0
SectionEnd

Section /o "Start Menu Shortcuts"


You use Section /o but you also need to put the desktop shortcut command in its own section.


Originally posted by demiller9
Section /o "Start Menu Shortcuts"
All that did was remove the check mark from the item "Start Menu Shortcuts". What I'm trying to do is get the desktop icon offered as an option in the following screen capture:

http://aa4m.com/Clipboard.jpg

Originally posted by redxii
You use Section /o but you also need to put the desktop shortcut command in its own section.
That worked, and I didn't even use the /o, which I guess is just a toggle for the check marks!

Thanks, Bill

Originally posted by BMullin
/o, which I guess is just a toggle for the check marks!
You could have found that in the manual.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.6.1.2