!include "MUI.nsh" !include "Sections.nsh" ;-------------------------------- ;General ;Name and file Name "$(DESC_SecDummy13)" OutFile "test.exe" BrandingText "$(DESC_SecDummy2)" ; ShowInstDetails show ; ShowInstDetails hide Var nsCheck Var steamExe ;Var MultiIns Function findSteam ReadRegStr $8 HKCU \ "Software\Valve\Steam" \ "ModInstallPath" Pop $8 StrCmp $8 "" skip checkInstall checkInstall: StrCpy $nsCheck "$8\ns" GoTo skip2 skip: MessageBox MB_OK|MB_ICONSTOP "$(DESC_SecDummy3)" abort skip2: Call checkNS FunctionEnd Function checkNS IfFileExists "$nsCheck\dlls\ns.dll" exist notexist exist: Goto skip notexist: Call noNS skip: StrCpy $INSTDIR "$nsCheck" FunctionEnd Function noNS MessageBox MB_OK|MB_ICONSTOP "$(DESC_SecDummy4)" MessageBox MB_YESNO|MB_ICONQUESTION "$(DESC_SecDummy18)" IDNO Kill ExecShell "open" "http://www.google.com" Quit Kill: Quit FunctionEnd Function findSteamExe ReadRegStr $steamExe HKCU \ "Software\Valve\Steam" \ "SteamExe" FunctionEnd Function .onVerifyInstDir StrCmp $INSTDIR "$nsCheck" PathGood Abort PathGood: FunctionEnd ;-------------------------------- ;Interface Settings !define MUI_ICON 3.ico !define MUI_UNICON 4.ico !define MUI_COMPONENTSPAGE_CHECKBITMAP 4.bmp !define MUI_WELCOMEFINISHPAGE_BITMAP 3.bmp !define MUI_UNWELCOMEFINISHPAGE_BITMAP 3.bmp !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP 5.bmp ; !define MUI_LICENSEPAGE_CHECKBOX ; !define MUI_LICENSEPAGE_RADIOBUTTONS !define MUI_ABORTWARNING ; !define MUI_ABORTWARNING_TEXT !define MUI_FINISHPAGE_LINK google.com ; !define MUI_FINISHPAGE_LINK_COLOR 000080 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.google.com/" !define MUI_FINISHPAGE_RUN $steamExe !define MUI_FINISHPAGE_RUN_PARAMETERS " -applaunch 70 -game $\"ns$\" " ;MUI_FINISHPAGE_RUN_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\$(DESC_SecDummy15)" ; !define MUI_FINISHPAGE_NOAUTOCLOSE ; !define MUI_UNFINISHPAGE_NOAUTOCLOSE ; !define MUI_STARTMENU_DEFAULTFOLDER "" ;-------------------------------- ;Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "$(DESC_SecDummy16)" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_RESERVEFILE_LANGDLL Function .onInit ; !insertmacro MUI_LANGDLL_DISPLAY Call findSteam Call findSteamExe ; System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Installer") i .r1 ?e' ; Pop $MultiIns ; StrCmp $MultiIns 0 +3 ; MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." ; Abort System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e" Pop $0 StrCmp $0 0 launch StrLen $0 "$(^Name)" IntOp $0 $0 + 1 loop: FindWindow $1 '#32770' '' 0 $1 IntCmp $1 0 +4 System::Call "user32::GetWindowText(i r1, t .r2, i r0) i." StrCmp $2 "$(^Name)" 0 loop System::Call "user32::SetForegroundWindow(i r1) i." Abort launch: FunctionEnd ;-------------------------------- ;Installer Sections Section -readme SetOutPath "$INSTDIR" File google.com.url SectionEnd Section -setfileattributes SetFileAttributes $INSTDIR\google.com.url READONLY SectionEnd SubSection /e "Group 1" SecDummy Section "Option 1" SecDummy1 SetOutPath "$INSTDIR" IfFileExists "$INSTDIR\test.txt" 0 +2 Delete "$INSTDIR\test.txt" File "test.txt" SectionEnd Section "Option 2" SetOutPath "$INSTDIR" IfFileExists "$INSTDIR\test.txt" 0 +2 Delete "$INSTDIR\test.txt" File "test.txt" SectionEnd Section "Option 3" SetOutPath "$INSTDIR" IfFileExists "$INSTDIR\test.txt" 0 +2 Delete "$INSTDIR\test.txt" File "test.txt" SectionEnd SubSectionEnd Section "Group 2" SetOutPath "$INSTDIR" IfFileExists "$INSTDIR\test.txt" 0 +2 Delete "$INSTDIR\test.txt" File "test.txt" SectionEnd ;-------------------------------- ;Descriptions ;Language strings LangString DESC_SecDummy ${LANG_ENGLISH} "A test English section." LangString DESC_SecDummy1 ${LANG_ENGLISH} "A test English subsection." LangString DESC_SecDummy2 ${LANG_ENGLISH} "Test Installer" LangString DESC_SecDummy3 ${LANG_ENGLISH} "Unable to find Steam installation.$\r$\nPlease install Steam and try again." LangString DESC_SecDummy4 ${LANG_ENGLISH} "Unable to find Natural-Selection installation.$\r$\nPlease install Natural-Selection and try again." LangString DESC_SecDummy13 ${LANG_ENGLISH} "Test English" LicenseLangString DESC_SecDummy16 ${LANG_ENGLISH} "License_English.txt" LangString DESC_SecDummy18 ${LANG_ENGLISH} "Would you like to download Natural-Selection v3.0?" ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy) !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy1} $(DESC_SecDummy1) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;SectionGroupEnd