Archive: Need help with controlling available install options


Need help with controlling available install options
Ok firstly I am fairly new to NSIS so I apologise if I am asking a question that has already been answered, I did however search for previous topics but nothing seemed to cover specifically what I am trying to do.

Basically, my installation has 3 sections:

Base Files
Animated Installation
Non-Animated Installation

Now, the install file itself works just fine, however, if a user chose to install all the options, this would result in a corrupt install. As such, what I want to do is set it so that "Base Files" can not be unselected as those are required for either installation, and set it so that Animated Installation and Non-Animated Installation are unchecked by default.

What I would then like to do is set a condition so that if a user selects the Animated Installation option, the Non-Animated Installation option would then grey out so that the user was unable to select both. Similarly if a user was to select the Non-Animated Installation option, the Animated Installation option would then grey out so that the user was unable to select both.

This code example kind of looks like it would do what I am asking, however this looks to be for an older version of NSIS so I was unsure if this code would work for me: nsis.sourceforge.net/Controlling_Available_Install_Options

Currently, this is how the installer looks when it gets to the choose components section, obviously having both the Animated and Non-Animated options selected is not the ideal scenario here:
http://i444.photobucket.com/albums/q.../setupfile.jpg


Any help would be appreciated, and thanks in advance.

Mike

EDIT - I am using the latest version of NSIS.


Sections.nsh has macros that help you do this (You want the *Radio* macros)


I should have posted this earlier, but I found an example script which works in the latest version of NSIS at the following link:

nsis.sourceforge.net/Examples/one-section.nsi

Needless to say I now have it successfully implemented in my install script.

Thanks for the help anyway.

Cheers, Mike


I hope this helps
Actually, I am in the middle of doing the same thing, so I might as well paste my script here for you to copy.

Try to look over all of the crap you don't need and just go to the juice. The examples that helped me are the mathtest.nsi believe it or not.

Please excuse all of the extra code, again.

What I did was set a variable called install_type
then depending on which radio button was selected, I set the variable's value to 0 or 1, in the .onInit I set it to -1 for No radio buttons selected.

The current bug I am having myself, is that if none are selected, and you press cancel, it doesn't close. But hopefully this is a start.

I am also going to provide the ini file I used as an attachment. I really hope this helps. It isn't bug free cause I am writing it myself this very second.



/******************************************************************************
;NSIS Modern User Interface
;Copyright 2004-2009 Josh Lee
; Special thanks to Bob Gneu for helping with the Registry Key logic of UT3
;--------------------------------

-1 Compressor Setings
-2 User Over-ridable Config
-3 Constants
-4 Registry Information
-5 Variable Decleration
-6 Pages
-7 Language Definition
-8 Section Over-rides
-8.5 Page Overrides (after sections for variable def.)
-9 Function Decleration
******************************************************************************/
/* BUGS, xxx:todo list
license is always in spanish

*/
!include "MUI.nsh"
!include "Sections.nsh"

!include FileFunc.nsh
!include "StrFunc.nsh"
${StrRep}


;=== Runtime Switches
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On
XPStyle on
CRCCheck on
AutoCloseWindow True
;Request application privileges for Windows Vista
RequestExecutionLevel user


;!insertmacro MUI_LANGUAGE "English" ;first language is the default language
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\French.nlf"
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\Italian.nlf"
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"

LicenseLangString myLicenseData ${LANG_ENGLISH} "required_files\licenses\english.txt"
LicenseLangString myLicenseData ${LANG_FRENCH} "required_files\licenses\french.txt"
LicenseLangString myLicenseData ${LANG_GERMAN} "required_files\licenses\german.txt"
LicenseLangString myLicenseData ${LANG_ITALIAN} "required_files\licenses\italian.txt"
LicenseLangString myLicenseData ${LANG_SPANISH} "required_files\licenses\spanish.txt"
LicenseData $(myLicenseData)
###############################################################################
###############################################################################
# Begin Config
;--------------------------------
;General

;Name and file
NAME "Unreal Tournament 3 - Jailbreak"
!define VERSION "Alpha9"
!define SHORTNAME "JB_${VERSION}"
!define UNINSTALLER "Uninstall_Jailbreak.exe"
; Version of installer in X.X.X.X format (requried by NSIS2 MUI)
!define JAILBREAK_INSTALLER_VERSION "1.0.0.0"

; Installer File name
OutFile "${SHORTNAME}_Installer.exe"

;Default installation folder
InstallDir "$DOCUMENTS\My Games\Unreal Tournament 3\UTGame\Published\CookedPC"

; images
;=== Icon & Stye ===
!define AP_ICON "required_files\JBIcon.ico"
!define LOGO "required_files\logo.bmp"
!define SPLASH "required_files\logo.bmp"
;=== BEGIN: BASIC INFORMATION
!define NAME "Unreal Tournament 3 - Jailbreak x"
!define Caption "${NAME} - Installer"
;=== Program Icon
Icon "${AP_ICON}"
!define STARTMENUFOLDER "Unreal Tournament 3\PlanetJailbreak.com"
!define DEFAULT_DESTINATION "${InstallDir}"
!define CHECKRUNNING "UT3.exe"
!define CLOSENAME "Unreal Tournament 3"
!define PRODUCT_WEB_SITE "http://www.PlanetJailbreak.com"
!define INSTALLERCOMMENTS "For additional details, visit PlanetJailbreak.com xxx:todo"
!define INSTALLERADDITIONALTRADEMARKS "Jailbreak is a Trademark of PlanetJailbreakâ„¢" ;end this entry with a period and a space if used
!define INSTALLERLEGALCOPYRIGHT "PlanetJailbreakâ„¢ and contributors."
;!define LICENSEAGREEMENT "required_files\JBLicense.txt"
!define PRODUCT_COMPANY "PlanetJailBreak.com"
!define MESSAGE_INTRO "UT3 Jailbreak has been installed."
!define MESSAGE_SIGNATURE "$\n$\nFor further assistance please use the forums at PlanetJailbreak.com. $\n$\n- UT3 Jailbreak | Project Lead - Wormbo"
!define SUCCESS_MESSAGE "${MESSAGE_INTRO} $\n$\nThere are shortcuts available to you in your installation directory. ${MESSAGE_SIGNATURE}"
!define FAILURE_MESSAGE "${MESSAGE_INTRO} $\n$\nUnfortunately your UT3 installation was not found in the registry. ${MESSAGE_SIGNATURE}"
;Interface Settings
;=== Header Icon
!define MUI_ICON "${AP_ICON}"
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP "${LOGO}"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectory


# Command Line
!define UT3_BINARY_LOC "Binaries\UT3.exe"
!define STEAM_UT3_DIR "\steamapps\common\unreal tournament 3\"

!define UT3_CMD_OPTIONS "-mod=..\Jailbreak -solomod"

!define EDITOR_LNK "UnrealED - Jailbreak.lnk"
!define GAME_LNK "Play Jailbreak.lnk"
# End Config
###############################################################################
###############################################################################
# Begin Constants
;--------------------------------------------------------------------------------------------------------------------
# Branding Variables
;!include "required_files\constants.nsh"
BrandingText "${INSTALLERLEGALCOPYRIGHT}"
VIProductVersion "${JAILBREAK_INSTALLER_VERSION}"
VIAddVersionKey ProductName "${NAME}"
VIAddVersionKey Comments "${INSTALLERCOMMENTS}"
VIAddVersionKey PRODUCT_COMPANY "${PRODUCT_COMPANY}"
VIAddVersionKey ProductWebsite "${PRODUCT_WEB_SITE}"
VIAddVersionKey Website "${PRODUCT_WEB_SITE}"
VIAddVersionKey LegalCopyright "${INSTALLERLEGALCOPYRIGHT}"
VIAddVersionKey FileDescription "${NAME}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey InternalName "${NAME}"
VIAddVersionKey LegalTrademarks "${INSTALLERADDITIONALTRADEMARKS}"
VIAddVersionKey OriginalFilename "${FILENAME}.paf.exe"
VIAddVersionKey PlanetJailbreak.comInstallerVersion "${JAILBREAK_INSTALLER_VERSION}"
# End Constants
###############################################################################
###############################################################################
# Begin Registry Information
;--------------------------------------------------------------------------------------------------------------------
# Registry Key Variables
;!include "required_files\registry_keys.nsh"

;--------------------------------
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${PRODUCT_COMPANY}" ""
;language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${PRODUCT_COMPANY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;start menu
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT_COMAPNY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"

!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_COMPANY}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
# UT3 CU Registry Keys
!define INSTALL_CU_KEY_UNK1_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_CU_KEY_UNK2_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_CU_KEY_UNK3_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_CU_KEY_UNK4_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_CU_KEY_US_WIN_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
!define INSTALL_CU_KEY_UNK1_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_CU_KEY_UNK2_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_CU_KEY_UNK3_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_CU_KEY_UNK4_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_CU_KEY_US_WIN_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"

# UT3 LM Registry Keys
!define INSTALL_LM_KEY_UNK1_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_LM_KEY_UNK2_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_LM_KEY_UNK3_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_LM_KEY_UNK4_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_LM_KEY_US_WIN_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
!define INSTALL_LM_KEY_UNK1_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_LM_KEY_UNK2_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_LM_KEY_UNK3_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_LM_KEY_UNK4_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_LM_KEY_US_WIN_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
# Steam Registry Keys
!define INSTALL_KEY_STEAM "Software\Valve\Steam"


# End Registry Information
###############################################################################
###############################################################################
# Begin Variable Decleration
;--------------------------------------------------------------------------------------------------------------------
;Variables
Var StartMenuFolder
Var install_type ; 0 regular - 1 nohome
# End Variable Decloration
###############################################################################
###############################################################################
# Begin Pages
;--------------------------------------------------------------------------------------------------------------------
;Pages
ReserveFile "ioInstallType.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; Installer Pages
; !define MUI_CUSTOMFUNCTION_GUIINIT CustomPageFunction

!define MUI_WELCOMEPAGE_TITLE "Unreal Tournament 3 - Jailbreak"
!insertmacro MUI_PAGE_WELCOME

#!ifdef LICENSEAGREEMENT
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE $(myLicenseData)
#!endif


Page custom PAGE_ioInstallType

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!define MUI_STARTPAGE_TITLE "Test"

!insertmacro MUI_PAGE_INSTFILES

!define MUI_FINISHPAGE_TITLE "Jailbreak"
!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_TEXT "$(finish)"
; Un-installer Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# End Pages

Function PAGE_ioInstallType ;FunctionName defined with Page command
;Feel free to improve here...

;StrCpy $ioInstallTypeFile "ioInstallType.ini"

;Set the Language lines here before displaying the form
IntOp $install_type 0 - 1
Reset:
!insertmacro MUI_HEADER_TEXT "Install Type" "Please select one of the folowing before continuing."
;!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "${ioInstallTypeFile}"

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioInstallType.ini"
;File /oname="ioInstallType.ini" ".\ioInstallType.ini"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioInstallType.ini" "Field 1" "Text" "Default (Curent User)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioInstallType.ini" "Field 2" "Text" "Advanced (--nohomedir)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioInstallType.ini" "Field 3" "Text" "This is the standard Jailbreak installation."
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioInstallType.ini" "Field 4" "Text" "For users that have specified '--nohomedir' for their game. Only recommended for experienced users."
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioInstallType.ini" "Field 5" "Text" "Choose the type of installation you prefer, then click Next."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioInstallType.ini"
;--------------------------------------------------------------------------------------------------------------------
!insertmacro INSTALLOPTIONS_READ $R0 "ioInstallType.ini" "Field 1" "State"
IntCmp $R0 1 do_STANDARD_INSTALL
;--------------------------------------------------------------------------------------------------------------------
!insertmacro INSTALLOPTIONS_READ $R0 "ioInstallType.ini" "Field 2" "State"
IntCmp $R0 1 do_CUSTOM_INSTALL
;--------------------------------------------------------------------------------------------------------------------
IntCmp $install_type -1 StartReset

StartReset:
MessageBox MB_OK|MB_ICONEXCLAMATION "Please select an option."
Goto Reset

do_STANDARD_INSTALL:
IntOp $install_type 0 + 0
Abort
do_CUSTOM_INSTALL:
IntOp $install_type 0 + 1
Abort
FunctionEnd



###############################################################################
###############################################################################
# Begin Language Definition
;--------------------------------------------------------------------------------------------------------------------
;Language Selection Dialog Settings
;Remember the installer language

;--------------------------------------------------------------------------------------------------------------------
;Languages
;!include "required_files\language_setup.nsh"
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "French"
/*
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Esperanto"
*/

;LangString welcome ${LANG_ENGLISH} "This wizard will guide you through the installation of ${NAME}.\r\n\r\nIf you are upgrading an existing installation of ${NAME}, please close UT3 before proceeding.\r\n\r\nClick Next to continue."
LangString finish ${LANG_ENGLISH} "${NAME} has been installed on your device.\r\n\r\nClick Finish to close this wizard."
LangString runwarning ${LANG_ENGLISH} "Please close all instances of ${CLOSENAME} and then click OK. Jailbreak Mod can not be upgraded while it is running."
LangString invaliddirectory ${LANG_ENGLISH} "The destination folder you selected is invalid. Please choose a valid folder."
LangString notenoughspace ${LANG_ENGLISH} "The device you have selected to install to does not have enough free space for Jailbreak."
; LangString required ${LANG_ENGLISH} "required"
;LangString checkforplatform ${LANG_ENGLISH} "Checking for previous install of Jailbreak"
;LangString refreshmenu ${LANG_ENGLISH} "Refreshing Jailbreak Menu"



# End Language Definition
###############################################################################
;--------------------------------------------------------------------------------------------------------------------
;Reserve Files
!insertmacro MUI_RESERVEFILE_LANGDLL
;If you are using solid compression, files that are required before
;the actual installation should be stored first in the data block,
;because this will make your installer start faster.

###############################################################################
###############################################################################
# Begin Section Over-rides
;--------------------------------
;Installer Sections

Section "!Jailbreak (required)" section_jailbreak_main
SectionIn RO
SetOutPath $INSTDIR

;Store installation folder
WriteRegStr HKCU "Software\Jailbreak" "" $INSTDIR


# Begin copying necessary files over
;File /oname=$OUTDIR\readme.txt readme.txt
;File /oname=$OUTDIR\changelog.txt changelog.txt

# CustomChars
;CreateDirectory $OUTDIR\Screenshots

;CreateDirectory $OUTDIR\Splash

;SetOutPath $INSTDIR\Splash
;File /oname=$OUTDIR\Splash.bmp ..\..\Trunk\Splash\Splash.bmp
;File /oname=$OUTDIR\EdSplash.bmp ..\..\Trunk\Splash\EdSplash.bmp

# Maps
CreateDirectory $INSTDIR\Maps
# Localization
CreateDirectory $INSTDIR\Localization
CreateDirectory $INSTDIR\Localization\DEU
CreateDirectory $INSTDIR\Localization\ESN
CreateDirectory $INSTDIR\Localization\FRA
CreateDirectory $INSTDIR\Localization\INT
CreateDirectory $INSTDIR\Localization\ITA

SetOutPath $INSTDIR\Localization

; Write Uninstaller information

WriteUninstaller "$INSTDIR\${UNINSTALLER}"

WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "DisplayName" "${NAME}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINSTALLER}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${VERSION}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_COMPANY}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "Install Date" "${__TIMESTAMP__}"
#######################################################################
# Sub Section Start Menu Begin
;!include "required_files\start_menu.nsh"
;Call setStartFolder
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

SetOutPath $INSTDIR

# Get the path to the UT3 binary



WriteIniStr "$INSTDIR\${PRODUCT_COMPANY}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Website.lnk" "$INSTDIR\${PRODUCT_COMPANY}.url"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\${UNINSTALLER}"


ClearErrors

# Check Current User keys first
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK1_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK2_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK3_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK4_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_US_WIN_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK1_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK2_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK3_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK4_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_US_WIN_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors # Check the Local Machine keys
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK1_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK2_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK3_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK4_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_US_WIN_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK1_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK2_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK3_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK4_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_US_WIN_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_KEY_STEAM}" 'SteamPath'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_KEY_STEAM}" 'InstallPath'
IfErrors 0 CheckFiles
GOTO SkipShortcuts

CheckFiles:

${StrRep} $0 "$0" "/" "\"
IffileExists "$0Binaries\UT3.exe" CreateShortcuts 0
IffileExists "$0\steamapps\common\unreal tournament 3\Binaries\UT3.exe" 0 SkipShortcuts

CreateSteamShortcuts:
# Startup Menu Shortcuts
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${EDITOR_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${GAME_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"

# Install Directory Shortcuts
;CreateShortCut "$INSTDIR\${EDITOR_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$INSTDIR\${GAME_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"

MessageBox MB_OK "${SUCCESS_MESSAGE}"

GoTo Done
CreateShortcuts:
# Startup Menu Shortcuts
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${EDITOR_LNK}" "$0Binaries\UT3.exe" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${GAME_LNK}" "$0Binaries\UT3.exe" "${UT3_CMD_OPTIONS}"

# Install Directory Shortcuts
;CreateShortCut "$INSTDIR\${EDITOR_LNK}" "$0${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$INSTDIR\${GAME_LNK}" "$0${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"

MessageBox MB_OK "${SUCCESS_MESSAGE}"
GoTo Done

SkipShortcuts:
MessageBox MB_OK "${FAILURE_MESSAGE}"

Done:
;Create shortcuts

!insertmacro MUI_STARTMENU_WRITE_END
# End Sub Section Start Menu
#######################################################################

SectionEnd

Section "Jailbreak Maps" section_maps
SetOutPath $INSTDIR
SectionEnd

;Assign descriptions to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${section_jailbreak_main} "Jailbreak Mod."
!insertmacro MUI_DESCRIPTION_TEXT ${section_maps} "Jailbreak Maps."
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"
Delete "$INSTDIR\${UNINSTALLER}"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_COMPANY}"
SectionEnd
# End Section Over-rides
###############################################################################
###############################################################################
# Begin Function Decleration
;!include "required_files\functions.nsh"
;--------------------------------
;Installer Functions
Function .onGUIEnd
;System::Call "kernel32::RemoveMutexA(i 0, i 0, t 'WhiteMod_Mutex') i .r1 ?e"
FunctionEnd

Function .onInit
;------------------------------------------------------------------------------------------------------------
; Make sure we dont have two running...
System::Call "kernel32::CreateMutexA(i 0, i 0, t 'jailbreak_installer_mutex') i .r1 ?e"
Pop $R0

StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "There is already an installer running."
Abort

;------------------------------------------------------------------------------------------------------------
;spash screen
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "${SPLASH}"
;delay fadein fadeout
advsplash::show 2000 500 500 -1 $PLUGINSDIR\splash

Pop $0
Delete $PLUGINSDIR\splash.bmp
;------------------------------------------------------------------------------------------------------------
; if language was selected on a preious install, this won't run
!insertmacro MUI_LANGDLL_DISPLAY
;------------------------------------------------------------------------------------------------------------
; anoyance, start folder defaults to NAME
;Call setStartFolder
StrCpy $StartMenuFolder "${STARTMENUFOLDER}"
IntOp $install_type 0 - 1
;------------------------------------------------------------------------------------------------------------
FunctionEnd


;--------------------------------
;Uninstaller Functions

Function un.onInit
; Restore Language selection
; MoreInfo::GetOSUserinterfaceLanguage
; pop $LANGUAGE
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd

Function LeaveDirectory
GetInstDirError $0
;=== Does it already exist? (upgrade)
IfFileExists "$INSTDIR\Jailbreak.u" "" CheckInstallerError
;=== Check if app is running?
StrCmp ${CHECKRUNNING} "NONE" CheckInstallerError
FindProcDLL::FindProc "${CHECKRUNNING}"
StrCmp $R0 "1" "" CheckInstallerError
MessageBox MB_OK|MB_ICONINFORMATION "$(runwarning)"
Abort
CheckInstallerError:
${Switch} $0
${Case} 0 ;=== Valid directory and enough free space
${Break}
${Case} 1
MessageBox MB_OK "$(invaliddirectory)"
Abort
${Break}
${Case} 2
IfFileExists "$INSTDIR" "" NotEnoughSpaceNoUpgrade ;=== Is upgrade
SectionGetSize ${section_jailbreak_main} $1 ;=== Space Required for App
${GetRoot} "$INSTDIR" $2
${DriveSpace} "$2\" "/D=F /S=K" $3 ;=== Space Free on Device
${GetSize} "$INSTDIR" "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size
IntOp $7 $3 + $4 ;=== Space Free + Current Install Size

NotEnoughSpaceNoUpgrade:
MessageBox MB_OK "$(notenoughspace)"
Abort
${Break}
${EndSwitch}
FunctionEnd

Function setStartFolder
StrCpy $StartMenuFolder "${STARTMENUFOLDER}"
FunctionEnd
# End Function Decleration
###############################################################################

Sorry, the ini didn't get attached.



[Settings]
NumFields=5

[Field 1]
Type=RadioButton
Text=&Default (Curent User)
;State=1
Left=8
Right=200
Top=28
Bottom=38

[Field 2]
Type=RadioButton
Text=&Advanced (--nohomedir)
Left=8
Right=254
Top=57
Bottom=68

[Field 3]
Type=Label
Text=This is the standard Jailbreak installation.
Left=18
Right=254
Top=41
Bottom=56

[Field 4]
Type=Label
Text=For users that have specified '--nohomedir' for their game. Only recommended for experienced users.
Left=18
Right=254
Top=73
Bottom=98

; top
[Field 5]
Type=Label
Text=Choose the type of installation you prefer, then click Next.
Left=4
Right=268
Top=14
Bottom=22




The one bug in the thing I posted to help you might get answered here. Lets hope for both of us it does.


http://forums.winamp.com/showthread....hreadid=310433


This is what I used in the end, does the job nicely.

Section "$(RequiredSection)" SEC01
SectionIn RO
SectionEnd

Section "$(AnimInstall)" SEC02
SectionEnd

Section /o "$(NoAnimInstall)" SEC03
SectionEnd

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
StrCpy $1 ${SEC02} ; Group 1 - Option 1 is selected by default
FunctionEnd

Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC02}
!insertmacro RadioButton ${SEC03}
!insertmacro EndRadioButtons
FunctionEnd



Now I just need to figure out how to make the installer appear "always on top" - basically mid way through my install around 350 command prompt windows need to run. As such I want to keep the main install window on top, mainly for epilepsy suffers as I would not want to give them an epileptic shock.

you should probably run these command windows hidden with nsExec or one of the other "DOS exec plugins"

If you really want to use always on top, you would have to call user32::SetWindowPos with the system plugin


Hmmm interesting.

Ok, here is a snippet of code I have in place now

  ; Unset all file-attributes (like Read-Only) and check if gta3.img and gta3.dir exist
SetOutPath "$INSTDIR\models"
/*
IfFileExists "$INSTDIR\models\gta3.img" errModelInstall startModelInstallImg
Goto errModelInstall
startModelInstallImg:
IfFileExists "$INSTDIR\models\gta3.dir" errModelInstall startModelInstallDir
Goto errModelInstall
startModelInstallDir:
*/
SetFileAttributes "$INSTDIR\models\gta3.img" FILE_ATTRIBUTE_NORMAL
SetFileAttributes "$INSTDIR\models\gta3.dir" FILE_ATTRIBUTE_NORMAL
; Add models to gta3.img
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\baggage.dff"'
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\baggage.txd"'
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\bank1955.dff"'
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\bank1955.txd"'
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\banshee.dff"'
ExecWait '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\banshee.txd"'



So, could I change the ExecWait to nsExecWait ???

EDIT - Actually should it be nsExec::ExecWait ?

well, yes, nsExec by itself does not work since it is a plugin


All sorted, nsExec::Exec was the winner :)

Code Snippet

  nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\baggage.dff"'
nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\baggage.txd"'
nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\bank1955.dff"'
nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\bank1955.txd"'
nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\banshee.dff"'
nsExec::Exec '"$INSTDIR\addtogta3img\ImgEdCmd.exe" "$INSTDIR\models\gta3.img" /a "$INSTDIR\addtogta3img\banshee.txd"'