I cobbled this together from various sources I found. I'm trying to read the registry to find out if JAVA_HOME is defined, and if it is pop up the value. This is my code.
; Script generated by the HM NIS Edit Script Wizard.
; Strcontains addded by rcortese
; StrContains
; This function does a case sensitive searches for an occurrence of a substring in a string.
; It returns the substring if it is found.
; Otherwise it returns null("").
; Written by kenglish_hi
; Adapted from StrReplace written by dandaman32
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "TN1 Installer"
!define PRODUCT_VERSION "10.6.5"
!define PRODUCT_PUBLISHER "Boardvantage"
SetCompressor lzma
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "installers\boardvantage.ico"
; Welcome page
; Components page
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "bv_launch.exe"
InstallDir "C:\BV_TN1"
ShowInstDetails show
Section -SETTINGS
SetOutPath "$INSTDIR"
SetOverwrite on
SectionEnd
Section "Checking Environment Variables" SEC01
SetRegView 32
;test for java 1.6.024
ReadRegStr $3 HKLM 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME' Data
IfErrors 0 noJavaInstall
Goto doneJava
noJavaInstall:
ReadRegStr $1 HKLM 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME' Data
IfErrors 0 doneJava
ReadRegStr $1 HKLM 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME' Data
MessageBox MB_OK 'Good news, JAVA_HOME is set as, $1 .'
doneJava:
;All done.
NoJava:
;Write the script to install Java here
SectionEnd I'm trying to get the MessageBox to pop up and tell the user where JAVA_HOME is, but I'm not exactly sure where I'm messing up. Totally lost.