; EziManage: Records Install and Uninstall Script ; Timothy Bogie ; (c) Global Village Data Solutions - 2007 ;-------------------------------- ;Include Modern UI !include "MUI.nsh" !include "Sections.nsh" ;-------------------------------- ;General ;Name and file Name "Records App" OutFile "Setup_Win2k-XP.exe" ;Default installation folder InstallDir "$PROGRAMFILES\Records" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\Records" "" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "LICENSE AGREEMENT - Records.txt" ; User to navigate to the DB location !define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstallType !insertmacro MUI_PAGE_COMPONENTS Page custom NavigateDBLocation !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Installer Sections Section "Local Computer" INSTALL_OPTION_1 ; Selected by default SetOutPath "$INSTDIR" ;ADD YOUR OWN FILES HERE... ;Store installation folder WriteRegStr HKCU "Software\Records" "" $INSTDIR Section /o "Client Side" INSTALL_OPTION_2 ; files here! SectionEnd Section /o "Server Side" INSTALL_OPTION_3 ; files here! SectionEnd ;-------------------------------- ; Functions Function .onInit ; $1 stores the status of the radio buttons StrCpy $1 ${INSTALL_OPTION_1} ; "Local Computer is selected by default ; Extract the ini file that contains the info for the custome page "NavigateDBLocation" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "DB_LOC.ini" FunctionEnd Function .onSelChange !insertmacro StartRadioButtons $1 !insertmacro RadioButton ${INSTALL_OPTION_1} !insertmacro RadioButton ${INSTALL_OPTION_2} !insertmacro RadioButton ${INSTALL_OPTION_3} !insertmacro EndRadioButtons FunctionEnd LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Shared Database Location" LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Navigate to the shared database." Function InstallType ; Compare the vlaues of the the install type that was selected and ; ultimately skip the custom page if the default installation is ; selected StrCmp $1 "0" SkipDBLocationPage GotoDBLocationPage SkipDBLocationPage: MessageBox MB_OK "You must have selected ...OPTION_1" ; Remove the 'Abort' statement when I work out how to skip the ; NavigateDBLocation page and go to MUI_PAGE_DIRECTORY Abort GotoDBLocationPage: MessageBox MB_OK "You must have selected ...OPTION_2 or ...OPTION_3" ; Add the page script code to go to the Page NavigateDBLocation FunctionEnd Function NavigateDBLocation !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "DB_LOC.ini" FunctionEnd ;-------------------------------- ; Section Descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${INSTALL_OPTION_1} "The graphical interface and database are installed onto the local workstation." !insertmacro MUI_DESCRIPTION_TEXT ${INSTALL_OPTION_2} "The graphical interface is installed onto the local workstation and a connection is established to an existing database on a remote workstation." !insertmacro MUI_DESCRIPTION_TEXT ${INSTALL_OPTION_3} "The database is installed to the local workstation for remote users to connect to it." !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" RMDir /r "$INSTDIR" DeleteRegKey HKCU "Software\Records" SectionEnd