Archive: Installer request ;)


Installer request ;)
I don't know if it's asked to much, nevertheless I'm asking if someone is willing/wants to write me a little installer script for my BBCodeWriter Autohotkey script. Feel free to tell me if it's asked too much. :)

I already made a little one, but it's very limited. One thing is, it adds entries to startmenu although I uncheck the specified checkbox during install. On the other hand I always wanted an uninstaller for the script but don't know how to do it.
Is it possible to write an uninstall entry to the control panel - software - add/remove?
And last but not least, is it possible to ask the user during install if he/she would like to install it for all users or only for the currently registered user?

This is how far I came with v.2.14 and my limited knowledge:

!define TITLE "AHK BBCodeWriter"
!define VERSION 6.6

;#######################################
;Include Modern UI
!include "MUI.nsh"
;#######################################


;#######################################
; General

; Installer Name
Name "AHK BBCodeWriter"

; The file to write
OutFile "Setup BBCodeWriter.exe"

; The default installation directory
InstallDir C:\Tools\BBCode
;#######################################


;#######################################
;Interface Settings
!define MUI_ICON ${NSISDIR}\Contrib\Graphics\Icons\box-install.ico
!define MUI_UNICON ${NSISDIR}\Contrib\Graphics\Icons\box-uninstall.ico

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ${NSISDIR}\Contrib\Graphics\Header\win.bmp
!define MUI_HEADERIMAGE_UNBITMAP ${NSISDIR}\Contrib\Graphics\Header\win.bmp

!define MUI_ABORTWARNING
;#######################################


;#######################################
; Variables
Var STARTMENU_FOLDER
;#######################################


;#######################################
; Pages
!define MUI_PAGE_HEADER_TEXT "${TITLE} v${VERSION}"
!define MUI_PAGE_HEADER_SUBTEXT "An offline BBCode Editor written in Autohotkey"

!define MUI_WELCOMEPAGE_TITLE "${TITLE} v${VERSION}"
!insertmacro MUI_PAGE_WELCOME

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER

!define MUI_FINISHPAGE_RUN $INSTDIR\BBCodeWriter.exe
!insertmacro MUI_PAGE_FINISH
;#######################################


;#######################################
;Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
;#######################################


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

; Put files in InstallDir
File /r Files\*.*

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

; Create Shortcuts
CreateDirectory "$SMPROGRAMS\${TITLE}"
CreateShortCut "$SMPROGRAMS\${TITLE}\${TITLE}.lnk" "$INSTDIR\BBCodeWriter.exe"

!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;#######################################

I guess you may manage that installer easily with NSIS Quick Setup Script Generator


One thing is, it adds entries to startmenu although I uncheck the specified checkbox during install.
you should change the order of the installer pages.
your code for startmenu entries is in a "section", meaning it will be executed on page instfiles. your checkbox to choose if actually any shortcuts should be created is a page AFTER this.
you should flip the two pages:

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER


On the other hand I always wanted an uninstaller for the script but don't know how to do it.
see the user manual :)

Is it possible to write an uninstall entry to the control panel - software - add/remove?
yes, quite simple - a small topic in the user manual :)

[quopte]And last but not least, is it possible to ask the user during install if he/she would like to install it for all users or only for the currently registered user?[/quote]
search the forums/wiki.

there are several solutions for this one in here.

small hint: installoptions page.

Thx Guys,

looks like "NSIS Quick Setup Script Generator" is exactly what I was looking for. :)

Nevertheless thanks to Comm@nder21 for pointing out what is wrong in my script. I will have a look at it.