Wrench value from your Creo Investments Home Measure the benefits Simple Automation can bring Why
Automate?
A personal way to do PDM Peer to Peer
PDM
3D Drawings Model Based
Design
Smooth out unwanted sharp edges Other
Articles
www.proetoolbox.co.uk - Simple Automation made Simple

NSIS for Application Deployment


 
;NSIS 3.0 brings a new very simple UI configuration
;method called Modern UI 2
;-----------------------------------------------------
!include MUI2.nsh

; The name of the installer
Name "Scite4WL"

; The file to write
OutFile "Scite4WL.exe"

; The default installation directory (push onto desktop)
InstallDir $DESKTOP\Scite4WL

;Request application privileges for Windows Vista
RequestExecutionLevel user
  
;These definitions setup various peices of the Modern UI
;----------------------------------------------------------
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE "Welcome to the \
  Scite for Pro/Web.Link Editor Installer"
!define MUI_WELCOMEFINISHPAGE_BITMAP \
  "orange-scite4wl.bmp"
!define MUI_HEADERIMAGE true
!define MUI_HEADERIMAGE_RIGHT true
!define MUI_HEADERIMAGE_BITMAP "proetoolbox.bmp"
!define MUI_WELCOMEPAGE_TEXT "This installer will \
 guide you through the installation of Scite$\r$\ncomplete \
 with customized API files to produce a more efficient \
 Pro/Web.Link Application building experience.$\r$\n$\r$\nI \
 hope you enjoy it!.$\r$\n$\r$\nPress Next to continue."
!define MUI_PAGE_HEADER_TEXT "License Agreement" 

;The resources allow you to configure an installer just by
;calling up the series of pages you wish to run
;----------------------------------------------------------
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE  "license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

;These are the sections (components) that users can install
;----------------------------------------------------------
Section "Scite4WL" Section1
  SetOutPath $INSTDIR
  CreateDirectory "$INSTDIR\"
  ;This single line tells the installer compiler to grab all the
  ;files from the directory (recursively!) 
  File /r "D:\User Profiles\clewis\Scite4WL\deploy\*.*"
SectionEnd

Section "Scite4WL Shortcut" Section2
  ;This line makes a shortcut on the Desktop to our app
  CreateShortcut "$DESKTOP\Scite4WL.lnk" \
    "$INSTDIR\scite.exe"
SectionEnd

;These strings define what the text would be for the
;Components descriptions (only bothering with English)
;-----------------------------------------------------------
LangString DESC_Section1 ${LANG_ENGLISH} 
 "The Scite Program and API's."
LangString DESC_Section2 ${LANG_ENGLISH} 
 "A Shortcut to Scite 4 Pro/Web.Link."

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} \
  $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} \
  $(DESC_Section2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END


When building out my personal Scite for Pro/Web.Link configuration, I realized that I wanted to make it easy for others to re-use that configuration. Although it would be easy enough to just zip up the folder and suggest that folks just 'unzip', I came across Nullsoft Scriptable Install System. A wonderfull peice of Open Source code and after only a couple of hours of hacking, a professional looking installer was the result. While there are undoubtably many other better websites and examples for this wonderfull tool, I thought it would make sense to show how it was used to provide the Installer package for Scite for Pro/Web.Link.

The Choices

In many ways the choice I made to use NSIS was pre-ordained because the tool was free and looked easy to use. I'm sure that what I have acheived with it is equally possible with other installer solutions, but it took only a few hours to setup and learn which I think is important for us in keeping with the vision of Simple Automation.


Download and Learn NSIS from NSIS @ Sourceforge.

Code to Result Relationship

Conclusion

As NSIS says itself "An installer is the first experience of a user with your application. Slow or unsuccessful software installations are the most irritating computer problems. A quick and user friendly installer is therefore an essential part of your software product.". I think the few hours required to make a professional installer around the Scite for Pro/Web.Link configuration was well worth it. Owners of the 'A Pro/ENGINEERS Guide to Pro/Web.Link' book can download this customised editor from Bonus Applications.