;NSIS Modern User Interface version 1.70 ;InstallOptions Example Script ;Written by Joost Verburg ;--------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;General ;Name and file Name "$TOOL_NAME" OutFile "DocuBench_Setup.exe" ;Default installation folder ;InstallDir "$PROGRAMFILES\Modern UI Test" ;Get installation folder from registry if available ;InstallDirRegKey HKCU "Software\Modern UI Test" "" ShowInstDetails show ;-------------------------------- ;Variables Var INI_VALUE Var TOOL_NAME Var ML_ROOT Var STR_MLPATH Var ML_VER_TARGET Var SL_VER_TARGET Var SF_VER_TARGET Var STR_MLINFO ;-------------------------------- ;Pages !define MUI_WELCOMEPAGE_TITLE "Welcome to the $TOOL_NAME Setup Wizard" !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of $TOOL_NAME \r\n\r\n It assumes that \r\n\r\n\t $ML_VER_TARGET \r\n\r\n\t $SL_VER_TARGET \r\n\r\n\t $SF_VER_TARGET \r\n\r\n are already correctly installed $_CLICK" !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_COMPONENTS ;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Contrib\Modern UI\License.txt" Page custom CustomPageA ;Page custom CustomPageB ;!insertmacro MUI_PAGE_DIRECTORY ;Page custom CustomPageC !insertmacro MUI_PAGE_INSTFILES ;!insertmacro MUI_UNPAGE_CONFIRM ;!insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Reserve Files ;These files should be inserted before other files in the data block ;Keep these lines before any File command ;Only for solid compression (by default, solid compression is enabledfor BZIP2 and LZMA) ReserveFile "ioA.ini" ;ReserveFile "ioB.ini" ;ReserveFile "ioC.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;-------------------------------- ;Installer Sections Section "Zeon" SecZeon SetOutPath "$TEMP" File PDFDAWW750ST.exe File KeyFile-PDFDAWE702SN-8598_Sion.zli ExecWait "$TEMP\PDFDAWW750ST.exe" ExecWait "$TEMP\KeyFile-PDFDAWE702SN-8598_Sion.zli" Delete "$TEMP\PDFDAWW750ST.exe" Delete "$TEMP\KeyFile-PDFDAWE702SN-8598_Sion.zli" ;Read a value from an InstallOptions INI file ;!insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "ioC.ini" "Field 2" "State" ;Display a messagebox if check box was checked ; StrCmp $INI_VALUE "1" "" +2 ; MessageBox MB_OK "You checked the check box, here is the MessageBox..." SectionEnd Section "DocuBench" SecDocuBench SetOutPath "$INSTDIR" File sfprint_50p.p File simprintdlg_50p.p File coreFunction.p File ioA.ini File DocuBench.fig File DocuBench.m ;ADD YOUR OWN FILES HERE... ;Store installation folder ;WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR ;Create uninstaller ;WriteUninstaller "$INSTDIR\Uninstall.exe" ;Read a value from an InstallOptions INI file ;!insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "ioC.ini" "Field 2" "State" ;Display a messagebox if check box was checked ;StrCmp $INI_VALUE "1" "" +2 ; MessageBox MB_OK "You checked the check box, here is the MessageBox..." SectionEnd ;-------------------------------- ;Installer Functions Function .onInit strcpy $ML_VER_TARGET "Matlab 6.5" strcpy $SL_VER_TARGET "Simulink 5.0.2" strcpy $SF_VER_TARGET "StateFlow 5.0" strcpy $TOOL_NAME "DocuBench 0.9" ;InstallDir "$PROGRAMFILES\Modern UI Test" FunctionEnd Function checkMLPath ReadRegStr $ML_ROOT HKLM "SOFTWARE\MathWorks\MATLAB\6.5" "MATLABROOT" IfErrors NoML650Found ML650Found NoML650Found: strcpy $STR_MLPATH "NotInstalled" ;MessageBox MB_OK "DocuBench Installer $INSTDIR did not find Matlab 6.5 on this machine" ;SectionSetFlags SecZeon 10000 return ML650Found: ;Extract InstallOptions INI files !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini" Strcpy $INSTDIR "$ML_ROOT\\toolbox\\DocuBench" ;MessageBox MB_OK "DocuBench Install in $INSTDIR " IfFileExists $ML_ROOT ML650_DirFound NoML650_DirFound ML650_DirFound: strcpy $STR_MLPATH "Match" ;MessageBox MB_OK $STR_MLPATH return NoML650_DirFound: strcpy $STR_MLPATH "NoMatch" ;MessageBox MB_OK $STR_MLPATH return FunctionEnd LangString TEXT_IO_TITLE ${LANG_ENGLISH} "Select Components Page" LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This is a page created using the InstallOptions plug-in." Function CustomPageA SectionGetFlags SecDocuBench $2 MessageBox MB_OK $2 strcmp $1 "1" +2 0 return call checkMLPath strcmp $STR_MLPATH "NotInstalled" ML650_NotInstalled ML650_Installed ML650_NotInstalled: strcpy $STR_MLPATH "$ML_VER_TARGET has not been detected. Make sure it is installed properly" SectionSetFlags SecZeon 10000 strcpy $STR_MLINFO "\r\n\r\n \ $ML_VER_TARGET has not been detected. \ \r\n\r\n\t Windows Registry does not contain information about $ML_VER_TARGET installation. \ \r\n\r\n\t Please make sure $ML_VER_TARGET is correctly Installed. \ \r\n\r\n It will only be possible installing DocuCom Print Driver." Goto MessageBoxLabel ML650_Installed: strcmp $STR_MLPATH "Match" ML650_DirFound NoML650_DirFound NoML650_DirFound: strcpy $STR_MLPATH "$ML_VER_TARGET has not been found in $ML_ROOT as Windows Registry states." SectionSetFlags SecZeon 10000 strcpy $STR_MLINFO "\r\n\r\n \ $ML_VER_TARGET has not been found in $ML_ROOT as Windows Registry states. \ \r\n\r\n\t Please make sure $ML_VER_TARGET is correctly Installed. \ \r\n\r\n It will only be possible installing DocuCom Print Driver." Goto MessageBoxLabel ML650_DirFound: strcpy $STR_MLPATH "$ML_VER_TARGET has been found in $ML_ROOT" strcpy $STR_MLINFO "\r\n\r\n \ $ML_VER_TARGET has been found in $ML_ROOT as Windows Registry states. \ \r\n\r\n\t DocuBench will be installed in $INSTDIR." Goto +2 MessageBoxLabel: MessageBox MB_OK $STR_MLPATH ; Scrivo text in ioA.ini !insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Field 2" "State" $STR_MLINFO !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini" FunctionEnd Function CustomPageB !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini" FunctionEnd Function CustomPageC !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioC.ini" FunctionEnd ;-------------------------------- ;Descriptions ;Language strings LangString DESC_SecZeon ${LANG_ENGLISH} "Install Zeon DocuCom Prin Driver" LangString DESC_SecDocuBench ${LANG_ENGLISH} "Install DocuBench Matlab files" ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecDocuBench} $(DESC_SecDocuBench) !insertmacro MUI_DESCRIPTION_TEXT ${SecZeon} $(DESC_SecZeon) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" DeleteRegKey /ifempty HKCU "Software\Modern UI Test" SectionEnd