!include "MUI2.nsh" !define MUI_ICON "Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "Contrib\Graphics\Icons\modern-uninstall.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "Contrib\Graphics\UGX\banner.bmp" !define MUI_PAGE_HEADER_TEXT "Welcome to the Boiii Application Setup" !define MUI_PAGE_HEADER_SUBTEXT "Follow the instructions to install Boiii Application." !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH Name "Boiii Application" OutFile "BoiiiInstaller.exe" InstallDir $DESKTOP\BoiiiApp ShowInstDetails show ShowUnInstDetails show Icon "${MUI_ICON}" BrandingText "Boiii Application Setup" Var Dialog Var Checkbox Var CreateShortcut ; Declare the variable at the top with the others Page custom MyCustomPageCreate MyCustomPageLeave Page instfiles Function MyCustomPageCreate nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error Abort ${EndIf} ${NSD_CreateCheckbox} 0 -13u 100% 12u "Create a desktop shortcut" Pop $Checkbox ${NSD_Check} $Checkbox nsDialogs::Show FunctionEnd Function MyCustomPageLeave ${NSD_GetState} $Checkbox $CreateShortcut FunctionEnd !define MUI_PAGE_CUSTOMFUNCTION_LEAVE MyCustomPageLeave !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES Section "Main Application" SecMain SetOutPath $INSTDIR File "boiii.exe" SectionEnd Section "LocalAppData Files" SecData SetOutPath $LOCALAPPDATA\boiii File /r "boiii\*.*" SectionEnd Section "Create Desktop Shortcut" ${If} $CreateShortcut == ${BST_CHECKED} CreateShortcut "$DESKTOP\Boiii.lnk" "$INSTDIR\boiii.exe" ${EndIf} SectionEnd Section "Uninstall" Delete $INSTDIR\boiii.exe Delete "$DESKTOP\Boiii.lnk" RMDir /r $LOCALAPPDATA\boiii RMDir $INSTDIR SectionEnd !insertmacro MUI_LANGUAGE "English"