; check for latest version of UltraModernUI at https://sourceforge.net/projects/ultramodernui/files/UltraModernUI/
!include "UMUI.nsh"
!include Library.nsh

Var ALREADY_INSTALLED ; variable - no {} needed, just $

!define SOFA_VERSION "1.1.1" ; define - ${} needed
!define PY_VERSION "2.6"

!define MUI_ICON "G:\3 SOFA dev\sofa.main\images\sofa_32x32.ico"
!define UMUI_LEFTIMAGE_BMP "G:\3 SOFA dev\storage\sofa_left.bmp" ; found under ultramodern ui contrib skins
;!define MUI_BGCOLOR: "CDD9D7"
;!define BANNER_FG "ff0000"

; NOTE :
; ************************
; Pages Displayed in order
; ************************

; Welcome
!define MUI_PAGE_HEADER_TEXT "SOFA Statistics"
!define MUI_WELCOMEPAGE_TITLE "SOFA Statistics and Analysis v.${SOFA_VERSION}"
!define MUI_WELCOMEPAGE_TEXT "SOFA Statistics is a statistics program emphasising ease of use, \
learn as you go,\r\n and beautiful output. \
\r\n\r\nClicking Next will start installation of the following packages. All are needed. \
\r\nIf you have multiple Python installations, e.g. 2.7 and 2.6, link to 2.6 \
\r\n\r\n * python - the language SOFA is written in (SOFA needs 2.6) \
\r\n * wxPython - provides the interface for SOFA \
\r\n * numpy - provides numerical processing \
\r\n * Matplotlib - scientific graphing \
\r\n * MySQL-python, pysqlite, pygresql - for databases \
\r\n * pywin32 - enables MS Access, SQL Server and Excel \
\r\n * comtypes - needed for internal web display"
!insertmacro MUI_PAGE_WELCOME

; Licence
!insertmacro MUI_PAGE_LICENSE "G:\3 SOFA dev\licence.txt"

; Location folder
!insertmacro MUI_PAGE_DIRECTORY

; Install files
!insertmacro MUI_PAGE_INSTFILES

; Finish
!define MUI_FINISHPAGE_TITLE "SOFA Statistics should now be ready to use"
!define MUI_FINISHPAGE_TEXT "Changes to your installation of python could \
impact on the working of SOFA statistics. \
See documentation at http://www.sofastatistics.com for details."
!define MUI_FINISHPAGE_LINK "http://www.sofastatistics.com"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.sofastatistics.com"
!insertmacro MUI_PAGE_FINISH

; Uninstall
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

; http://forums.winamp.com/printthread.php?s=4d90165acf6fa187290bbbe00bb790b7&threadid=202244
;after all the other insertmacros
!insertmacro MUI_LANGUAGE "English"

;--------------------------------

; The name of the installer
Name "SOFA Statistics"

; The file to write
OutFile "sofastats-${SOFA_VERSION}_for_win.exe"

; Default installation directory
InstallDir "$PROGRAMFILES\sofastats"
; The text to prompt the user to enter a directory
DirText "Please choose a directory to install SOFA Statistics into."
;ShowInstDetails show
;ShowUnInstDetails show

; Request application privileges for Windows Vista
RequestExecutionLevel admin # http://forums.gforums.winamp.com/showthread.php?s=8a0906800e16ffd51be2d2fda1a23c4c&threadid=306563
; user is the other option I used to use

; http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1
;4.8.1.32 RequestExecutionLevel
;none|user|highest|admin
;Specifies the requested execution level for Windows Vista and Windows 7. The value is embedded in the installer and
; uninstaller's XML manifest and tells Vista/7, and probably future versions of Windows, what privileges level the
; installer requires. user requests the a normal user's level with no administrative privileges. highest will request
; the highest execution level available for the current user and will cause Windows to prompt the user to verify
; privilege escalation. The prompt might request for the user's password. admin requests administrator level and
; will cause Windows to prompt the user as well. Specifying none, which is also the default, will keep the manifest
; empty and let Windows decide which execution level is required. Windows Vista/7 automatically identifies NSIS
; installers and decides administrator privileges are required. Because of this, none and admin have virtually the same effect.
;It's recommended, at least by Microsoft, that every application will be marked with the required execution level.
; Unmarked installers are subject to compatibility mode. Workarounds of this mode include automatically moving any
; shortcuts created in the user's start menu to all users' start menu. Installers that need not install anything into
; system folders or write to the local machine registry (HKLM) should specify user execution level.
;More information about this topic can be found at MSDN. Keywords include "UAC", "requested execution level",
; "vista manifest" and "vista security".

;--------------------------------

; macros OK either in or out of a section
!macro exe_installer fil_name
  File "G:\3 SOFA dev\sofalibs\${fil_name}"
  ExecWait '"$INSTDIR\sofalibs\${fil_name}"'
!macroend
!macro msi_installer fil_name
  File "G:\3 SOFA dev\sofalibs\${fil_name}"
  ;http://nsis.sourceforge.net/Embedding_other_installers
  ExecWait '"msiexec" /i "$INSTDIR\sofalibs\${fil_name}"'
!macroend
;must be outside of a section because the nsh file defines a function internally
;must occur after the macros defined

!include "C:\Documents and Settings\grant\Desktop\sofastats\py_version_${PY_VERSION}.nsh"

Section ""

  ; Message Box has to be in a section
  MessageBox MB_OK "Only change from the standard installation options if you are an advanced user"

  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  ; Put files there
  File "G:\3 SOFA dev\sofa.main\anova.py"
  File "G:\3 SOFA dev\sofa.main\charting_dlg.py"
  File "G:\3 SOFA dev\sofa.main\charting_output.py"
  File "G:\3 SOFA dev\sofa.main\charting_pylab.py"
  File "G:\3 SOFA dev\sofa.main\chisquare.py"
  File "G:\3 SOFA dev\sofa.main\config_dlg.py"
  File "G:\3 SOFA dev\sofa.main\config_globals.py"
  File "G:\3 SOFA dev\sofa.main\controls.py"
  File "G:\3 SOFA dev\sofa.main\core_stats.py"
  File "G:\3 SOFA dev\sofa.main\csv_importer.py"
  File "G:\3 SOFA dev\sofa.main\dataselect.py"
  File "G:\3 SOFA dev\sofa.main\db_grid.py"
  File "G:\3 SOFA dev\sofa.main\db_tbl.py"
  File "G:\3 SOFA dev\sofa.main\demotables.py"
  File "G:\3 SOFA dev\sofa.main\dimtables.py"
  File "G:\3 SOFA dev\sofa.main\dimtree.py"
  File "G:\3 SOFA dev\sofa.main\excel_importer.py"
  File "G:\3 SOFA dev\sofa.main\excel_reader.py"
  File "G:\3 SOFA dev\sofa.main\filtselect.py"
  File "G:\3 SOFA dev\sofa.main\full_html.py"
  File "G:\3 SOFA dev\sofa.main\gdata_downloader.py"
  File "G:\3 SOFA dev\sofa.main\getdata.py"
  File "G:\3 SOFA dev\sofa.main\importer.py"
  File "G:\3 SOFA dev\sofa.main\indep2var.py"
  File "G:\3 SOFA dev\sofa.main\kruskal_wallis.py"
  File "G:\3 SOFA dev\sofa.main\lib.py"
  File "G:\3 SOFA dev\sofa.main\mann_whitney.py"
  File "G:\3 SOFA dev\sofa.main\my_exceptions.py"
  File "G:\3 SOFA dev\sofa.main\my_globals.py"
  File "G:\3 SOFA dev\sofa.main\normal.py"
  File "G:\3 SOFA dev\sofa.main\ods_importer.py"
  File "G:\3 SOFA dev\sofa.main\ods_reader.py"
  File "G:\3 SOFA dev\sofa.main\output.py"
  File "G:\3 SOFA dev\sofa.main\paired2var.py"
  File "G:\3 SOFA dev\sofa.main\pearsonsr.py"
  File "G:\3 SOFA dev\sofa.main\prefs.py"
  File "G:\3 SOFA dev\sofa.main\projects.py"
  File "G:\3 SOFA dev\sofa.main\projselect.py"
  File "G:\3 SOFA dev\sofa.main\quotes.py"
  File "G:\3 SOFA dev\sofa.main\rawtables.py"
  File "G:\3 SOFA dev\sofa.main\recode.py"
  File "G:\3 SOFA dev\sofa.main\report_table.py"
  File "G:\3 SOFA dev\sofa.main\settings_grid.py"
  File "G:\3 SOFA dev\sofa.main\setup.py"
  File "G:\3 SOFA dev\sofa.main\showhtml.py"
  File "G:\3 SOFA dev\sofa.main\spearmansr.py"
  File "G:\3 SOFA dev\sofa.main\start.pyw" ;pyw so no terminal window
  File "G:\3 SOFA dev\sofa.main\stats_output.py"
  File "G:\3 SOFA dev\sofa.main\stats_select.py"
  File "G:\3 SOFA dev\sofa.main\table_config.py"
  File "G:\3 SOFA dev\sofa.main\tree.py"
  File "G:\3 SOFA dev\sofa.main\ttest_indep.py"
  File "G:\3 SOFA dev\sofa.main\ttest_paired.py"
  File "G:\3 SOFA dev\sofa.main\wilcoxon.py"
  File "G:\3 SOFA dev\sofa.main\wxmpl.py"

  SetOutPath "$INSTDIR\boomslang"
  File "G:\3 SOFA dev\sofa.main\boomslang\__init__.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Bar.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\ClusteredBars.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Label.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Line.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Plot.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\PlotInfo.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\PlotLayout.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Scatter.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\StackedBars.py"
  File "G:\3 SOFA dev\sofa.main\boomslang\Utils.py"

  SetOutPath "$INSTDIR\googleapi"
  File "G:\3 SOFA dev\sofa.main\googleapi\__init__.py"
  
  SetOutPath "$INSTDIR\googleapi\atom"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\auth.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\client.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\core.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\data.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\http.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\http_core.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\http_interface.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\mock_http.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\mock_http_core.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\mock_service.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\service.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\token_store.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\atom\url.py"
  
  SetOutPath "$INSTDIR\googleapi\gdata"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\auth.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\client.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\core.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\data.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\gauth.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\sample_util.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\service.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\urlfetch.py"
	
  SetOutPath "$INSTDIR\googleapi\gdata\docs"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\docs\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\docs\client.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\docs\data.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\docs\service.py"

  SetOutPath "$INSTDIR\googleapi\gdata\oauth"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\oauth\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\oauth\rsa.py"
	
  SetOutPath "$INSTDIR\googleapi\gdata\spreadsheet"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\spreadsheet\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\spreadsheet\service.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\spreadsheet\text_db.py"
  
  SetOutPath "$INSTDIR\googleapi\gdata\tlslite"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\api.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\BaseDB.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\Checker.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\constants.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\errors.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\FileObject.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\HandshakeSettings.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\mathtls.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\messages.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\Session.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\SessionCache.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\SharedKeyDB.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\TLSConnection.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\TLSRecordLayer.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\VerifierDB.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\X509.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\X509CertChain.py"
	
  SetOutPath "$INSTDIR\googleapi\gdata\tlslite\integration"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\AsyncStateMachine.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\ClientHelper.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\HTTPTLSConnection.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\IMAP4_TLS.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\IntegrationHelper.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\POP3_TLS.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\SMTP_TLS.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\TLSAsyncDispatcherMixIn.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\TLSSocketServerMixIn.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\TLSTwistedProtocolWrapper.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\integration\XMLRPCTransport.py"

  SetOutPath "$INSTDIR\googleapi\gdata\tlslite\utils"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\__init__.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\AES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\ASN1Parser.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\cipherfactory.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\codec.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\compat.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Cryptlib_AES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Cryptlib_RC4.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Cryptlib_TripleDES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\cryptomath.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\dateFuncs.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\entropy.c"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\hmac.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\jython_compat.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\keyfactory.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\OpenSSL_AES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\OpenSSL_RC4.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\OpenSSL_RSAKey.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\OpenSSL_TripleDES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\PyCrypto_AES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\PyCrypto_RC4.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\PyCrypto_RSAKey.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\PyCrypto_TripleDES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Python_AES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Python_RC4.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\Python_RSAKey.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\RC4.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\rijndael.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\RSAKey.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\TripleDES.py"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\win32prng.c"
  File "G:\3 SOFA dev\sofa.main\googleapi\gdata\tlslite\utils\xmltools.py"

  SetOutPath "$INSTDIR\dbe_plugins"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\__init__.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_globals.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_ms_access.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_ms_sql.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_mysql.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_postgresql.py"
  File "G:\3 SOFA dev\sofa.main\dbe_plugins\dbe_sqlite.py"

  ;SetOutPath "$INSTDIR\tests"
  ;File "G:\3 SOFA dev\sofa.main\tests\__init__.py"
  ;File "G:\3 SOFA dev\sofa.main\tests\pstat.py"
  ;File "G:\3 SOFA dev\sofa.main\tests\stats.py"
  ;File "G:\3 SOFA dev\sofa.main\tests\test_misc.py"
  ;File "G:\3 SOFA dev\sofa.main\tests\test_stats.py"
  
  SetOutPath "$INSTDIR\locale\br\LC_MESSAGES"
  File "G:\3 SOFA dev\sofa.main\locale\br\LC_MESSAGES\sofastats.mo"
  SetOutPath "$INSTDIR\locale\es_ES\LC_MESSAGES"
  File "G:\3 SOFA dev\sofa.main\locale\es_ES\LC_MESSAGES\sofastats.mo"
  SetOutPath "$INSTDIR\locale\gl_ES\LC_MESSAGES"
  File "G:\3 SOFA dev\sofa.main\locale\gl_ES\LC_MESSAGES\sofastats.mo"
  SetOutPath "$INSTDIR\locale\hr_HR\LC_MESSAGES"
  File "G:\3 SOFA dev\sofa.main\locale\hr_HR\LC_MESSAGES\sofastats.mo"
  SetOutPath "$INSTDIR\locale\ru_RU\LC_MESSAGES"
  File "G:\3 SOFA dev\sofa.main\locale\ru_RU\LC_MESSAGES\sofastats.mo"

  SetOutPath "$INSTDIR\images"
  File "G:\3 SOFA dev\sofa.main\images\agpl3.xpm"
  File "G:\3 SOFA dev\sofa.main\images\area_chart.xpm"
  File "G:\3 SOFA dev\sofa.main\images\area_chart_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\bar_chart.xpm"
  File "G:\3 SOFA dev\sofa.main\images\bar_chart_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\blank.png"
  File "G:\3 SOFA dev\sofa.main\images\blankbutton.xpm"
  File "G:\3 SOFA dev\sofa.main\images\blankhelpbutton.xpm"
  File "G:\3 SOFA dev\sofa.main\images\blankhisto.xpm"
  File "G:\3 SOFA dev\sofa.main\images\boxplot.xpm"
  File "G:\3 SOFA dev\sofa.main\images\boxplot_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\clustered_bar_chart.xpm"
  File "G:\3 SOFA dev\sofa.main\images\clustered_bar_chart_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\CSV_with_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\CSV_without_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\data.gif"
  File "G:\3 SOFA dev\sofa.main\images\data_tight.gif"
  File "G:\3 SOFA dev\sofa.main\images\demo_chart.gif"
  File "G:\3 SOFA dev\sofa.main\images\demo_chart_tight.gif"
  File "G:\3 SOFA dev\sofa.main\images\exit.gif"
  File "G:\3 SOFA dev\sofa.main\images\google_spreadsheet.xpm"
  File "G:\3 SOFA dev\sofa.main\images\help.gif"
  File "G:\3 SOFA dev\sofa.main\images\histogram.xpm"
  File "G:\3 SOFA dev\sofa.main\images\histogram_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\import.gif"
  File "G:\3 SOFA dev\sofa.main\images\line_chart.xpm"
  File "G:\3 SOFA dev\sofa.main\images\line_chart_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\ODS_with_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\ODS_without_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\pie_chart.xpm"
  File "G:\3 SOFA dev\sofa.main\images\pie_chart_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\prefs.gif"
  File "G:\3 SOFA dev\sofa.main\images\projects.gif"
  File "G:\3 SOFA dev\sofa.main\images\projects_tight.gif"
  File "G:\3 SOFA dev\sofa.main\images\python_logo_only_16.xpm"
  File "G:\3 SOFA dev\sofa.main\images\python_small.xpm"
  File "G:\3 SOFA dev\sofa.main\images\scatterplot.xpm"
  File "G:\3 SOFA dev\sofa.main\images\scatterplot_sel.xpm"
  File "G:\3 SOFA dev\sofa.main\images\sofastats_start_bg.gif"
  File "G:\3 SOFA dev\sofa.main\images\sofastats_start_bg_tight.gif"
  File "G:\3 SOFA dev\sofa.main\images\sofa_left.xpm"
  File "G:\3 SOFA dev\sofa.main\images\speech_mark_large.xpm"
  File "G:\3 SOFA dev\sofa.main\images\speech_mark_small.xpm"
  File "G:\3 SOFA dev\sofa.main\images\stats.gif"
  File "G:\3 SOFA dev\sofa.main\images\stats_select.gif"
  File "G:\3 SOFA dev\sofa.main\images\stats_select_tight.gif"
  File "G:\3 SOFA dev\sofa.main\images\step_by_step.gif"
  File "G:\3 SOFA dev\sofa.main\images\table.gif"
  File "G:\3 SOFA dev\sofa.main\images\tick.png"
  File "G:\3 SOFA dev\sofa.main\images\tickwin.png"
  File "G:\3 SOFA dev\sofa.main\images\tinysofa.xpm"
  File "G:\3 SOFA dev\sofa.main\images\top_sofa.gif"
  File "G:\3 SOFA dev\sofa.main\images\upgrade.xpm"
  File "G:\3 SOFA dev\sofa.main\images\XLS_with_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\XLS_without_header.xpm"
  File "G:\3 SOFA dev\sofa.main\images\sofa_32x32.ico"

  ; need to save to program files etc so ready for subsequent user installs
  ; on same machine
  SetOutPath "$INSTDIR\css"
  File "G:\3 SOFA dev\sofastats\css\default.css"
  File "G:\3 SOFA dev\sofastats\css\grey spirals.css"
  File "G:\3 SOFA dev\sofastats\css\lucid spirals.css"
  File "G:\3 SOFA dev\sofastats\css\pebbles.css"

  SetOutPath "$INSTDIR\_internal"
  File "G:\3 SOFA dev\sofastats\_internal\sofa_db"

  SetOutPath "$INSTDIR\vdts"
  File "G:\3 SOFA dev\sofastats\vdts\general_var_dets.vdts"

  SetOutPath "$INSTDIR\projs"
  File "G:\3 SOFA dev\sofastats\projs\default.proj"

  SetOutPath "$INSTDIR\reports\sofastats_report_extras"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\arc.xd.js"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\blank.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\blank.htm"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\dojo.xd.js"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\gradient.xd.js"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\grey_spirals.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\lucid_spirals.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\pebbles.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\popupMenuBg.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\sofastats_charts.js"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\sofastatsdojo_minified.js"
  
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp.png"
  
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-defbrown.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-defbrown.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-defbrown.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-defbrown.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-defbrown.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-defbrown.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-defbrown.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-defbrown.png"

  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-greypurp.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-greypurp.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-greypurp.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-greypurp.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-greypurp.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-greypurp.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-greypurp.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-greypurp.png"

  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-paleblue.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-paleblue.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-paleblue.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-paleblue.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-paleblue.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-paleblue.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-paleblue.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-paleblue.png"

  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-paleorange.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-paleorange.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-paleorange.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-paleorange.gif"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorDown-paleorange.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorLeft-paleorange.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorRight-paleorange.png"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tooltipConnectorUp-paleorange.png"
  
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\tundra.css"
  File "G:\3 SOFA dev\sofastats\reports\sofastats_report_extras\vml.xd.js"

  ; http://osdir.com/ml/python.db.pysqlite.user/2005-05/msg00040.html (can be missing)
  ; http://nsis.sourceforge.net/Docs/AppendixB.html
  IfFileExists "$INSTDIR\start.pyw" 0 new_installation ; continue if true, else jump to new_installation label
    StrCpy $ALREADY_INSTALLED 1 ;set to non-zero value if already installed
  new_installation: ; already installed stays as initialised
  !insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "G:\3 SOFA dev\sofalibs\msvcr71.dll" $SYSDIR\msvcr71.dll $SYSDIR

  ;http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.15
  MessageBox MB_YESNO "Install additional packages? \
$\r$\n$\r$\nIf doing a reinstallation of SOFA Statistics, you've probably already installed the packages \
$\r$\n(e.g. Python 2.6, comtypes, etc) and won't need to do it again." IDYES true IDNO false
  true:
    Call py_version_install ; in included version file e.g. !include "C:\Documents and Settings\grant\Desktop\py_version_${PY_VERSION}.nsh
    Goto next
  false:
    DetailPrint "Quicker but will only work if all site-packages installed to correct version of Python"
  next:

  SetOutPath $INSTDIR
  ;Create shortcuts etc
  ;create desktop shortcut
  CreateShortCut "$DESKTOP\sofastats.lnk" \
                 "$INSTDIR\start.pyw" "" \
                 "$INSTDIR\images\sofa_32x32.ico"

  CreateDirectory "$SMPROGRAMS\sofastats"
  CreateShortCut "$SMPROGRAMS\sofastats\sofastats.lnk" \
                 "$INSTDIR\start.pyw" "" \
                 "$INSTDIR\images\sofa_32x32.ico"
  CreateShortCut "$SMPROGRAMS\sofastats\Uninstall.lnk" \
                 "$INSTDIR\Uninstall.exe" "" \
                 "$INSTDIR\uninstall.exe" 0
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"
  
SectionEnd ; end the section

;--------------------------------

;Uninstaller Section

Section "Uninstall"

  RMDir /r /REBOOTOK $INSTDIR
  RMDir /r /REBOOTOK "$PROFILE\sofastats"
  RMDir /r "$SMPROGRAMS\sofastats"
  Delete "$DESKTOP\sofastats.lnk"

SectionEnd
