- NSIS Discussion
- [NSIS 2.40] filling the installation window with a picture
Archive: [NSIS 2.40] filling the installation window with a picture
stopasking
13th October 2008 00:23 UTC
[NSIS 2.40] filling the installation window with a picture
hi,
im using NSIS 2.40 and i want to add a bigger size picture on the installation screen. currently, im only able to put that size:
http://home.arcor.de/davied/Bilder/IM_INSTALLER.png
but i want the pic to fill the whole page, except the buttons...(that means i dont want any text)
this, i do with
!define MUI_WELCOMEFINISHPAGE_BITMAP "Location/of/the/*.bmp"
can u help me? Thanks . :)
ZmAn3
13th October 2008 00:59 UTC
one way to do it is in the directory nsis is installed in goto
Contrib\Modern UI 2\Pages make a backup of Welcome.nsh
open the orginal in notepad look for
this line
;Image control
; ${NSD_CreateBitmap} 0u 0u 109u 193u ""
edit the last 2 numbers 190u is the width and 193u is the height so like the following will make the attached image
${NSD_CreateBitmap} 0u 0u 332u 193u ""
http://www.emeraldcpu.com/zman3/installer.jpg
stopasking
13th October 2008 21:46 UTC
hey,
thanks for your reply! i want my first page of installation to look exactly like that. i changed the welcome.nsh as u told, but as i compiled my .nsi script after that (which is in an other directory), there was no difference to the pic...
this is what i used in my script to put the picture...
!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Documents and Settings\a\My Documents\NSIS_Menu.bmp"
but still the same pic as in my first post :(
what did i do wrong?
ZmAn3
13th October 2008 21:49 UTC
is the picture the right size (big enough to fill the window) can u post it
stopasking
13th October 2008 22:02 UTC
Originally posted by ZmAn3
is the picture the right size (big enough to fill the window) can u post it
it is 497x362
[IMG]
http://img387.imageshack.us/img387/7...menupp7.th.pnghttp://img387.imageshack.us/images/thpix.gif[/IMG]
here u go...is it enoguh to fill the window?
ZmAn3
13th October 2008 22:12 UTC
ya
http://www.emeraldcpu.com/zman3/installer.jpg
so in welcome.nsh under the image control section
you should have
;Image control
; ${NSD_CreateBitmap} 0u 0u 109u 193u ""
${NSD_CreateBitmap} 0u 0u 332u 193u ""
Pop $mui.WelcomePage.Image
the one with the ; is the old one
stopasking
13th October 2008 22:51 UTC
i have done that, but dunno why it isnt doing it like this...
maybe it isnt checking the welcome.nsh before compiling? (because the .nsi file, which i compile, is in some other directory)...where did u put the path to the pic in?
thats my script...
;===============================================================================
;
; G2MDK - DemoMod Setup-Script
;
; System: NSIS 2.0 http://nsis.sf.net/
; Editor: HMNE 2.0 http://hmne.sf.net/
;
;===============================================================================
; Kompressionseinstellungen
CRCCheck force
;SetCompressor lzma
;SetCompressorDictSize 128 ; LZMA-Speicherverbrauch, siehe Tabelle
; DictSize Compress Decomp
; 8 MB 141 MB 10 MB (default)
; 12 MB 179 MB 14 MB
; 16 MB 217 MB 18 MB
; 24 MB 293 MB 26 MB
; 32 MB 369 MB 35 MB
; 48 MB 521 MB 50 MB
; 64 MB 673 MB 66 MB
; 96 MB 977 MB 98 MB
; 128 MB 1281 MB 130 MB
; 192 MB 1889 MB 194 MB
;!packhdr "packhdr.tmp" "upx.exe --best packhdr.tmp" ; http://upx.sf.net/
; Definitionen
; TODO: Version der Modifikation
!define VER_MAJOR 1 ; Major Version
!define VER_MINOR 0 ; Minor Version
!define VER_PATCH 0 ; Patch-Version (1=a, ...)
!define VER_FLAGS 0 ; Sprachversion
!define VER_FILE "${VER_MAJOR}.${VER_MINOR}"
!define VER_TEXT "${VER_MAJOR}.${VER_MINOR}"
; TODO: Eigenschaften der Modifikation
!define MOD_FILE "Orkherrschaft" ; Mod-Dateiname (KEINE Leer- oder Sonderzeichen!)
!define MOD_NAME "Orkherrschaft" ; Mod-Titel
!define MOD_COPY "Copyright © 2004, Pluto 13 GmbH" ; Mod-Copyright
!define MOD_COMP "SunStars" ; Mod-Herausgeber
!define MOD_LINK "http://sunstars.worldofgothic.com" ; Herausgeber-Link
!define MOD_HELP "http://www.worldofgothic.de" ; Support-Link
;===============================================================================
;
; MUI
;
!include "MUI.nsh"
Name "${MOD_NAME} ${VER_TEXT}"
OutFile "${MOD_FILE}-${VER_FILE}.exe"
InstallDir "$PROGRAMFILES\JoWooD\Gothic II\"
!define MOD_RKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_NAME}"
InstallDirRegKey HKLM "${MOD_RKEY}" "InstallLocation"
AllowRootDirInstall true
; Konfiguration (Installer)
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "Dieser Assistent wird Sie durch die Installation von $(^Name) begleiten.\r\n\r\nEs wird empfohlen vor der Installation alle anderen Programme zu schließen.\r\n\r\n$_CLICK"
!define MUI_COMPONENTSPAGE_NODESC
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Documents and Settings\a\My Documents\NSIS_Menu.bmp"
; Setup-Seiten (Installer)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ".\setup\licence.rtf"
Page custom PageReinstall PageLeaveReinstall
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Konfiguration (Uninstaller)
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "Dieser Assistent wird Sie durch die Deinstallation von $(^Name) begleiten.\r\n\r\nBitte beenden Sie Gothic II und zugehörige Tools,\r\nbevor Sie mit der Deinstallation fortfahren.\r\n\r\n$_CLICK"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_TITLE_3LINES
; Setup-Seiten (Uninstaller)
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; Setup-Sprache
!insertmacro MUI_LANGUAGE "German"
; Reservierte Dateien
ReserveFile "setup.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
;===============================================================================
;
; Installer
;
; Setup.exe Versionsinformationen (Sprache = MUI_LANGUAGE)
VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.${VER_FLAGS}"
VIAddVersionKey "CompanyName" "${MOD_COMP}"
VIAddVersionKey "FileVersion" "${VER_TEXT}"
VIAddVersionKey "LegalCopyright" "${MOD_COPY}"
VIAddVersionKey "FileDescription" "${MOD_NAME}"
VIAddVersionKey "OriginalFilename" "${MOD_FILE}-${VER_FILE}.exe"
LangString NameInstFull ${LANG_GERMAN} "Vollständig"
InstType $(NameInstFull)
!include ".\setup\g2mod.nsh"
;-------------------------------------------------------------------------------
;
; Init (nicht angezeigt)
;
; Installer
Section -pre
Push $R0
SetDetailsPrint none
StrCpy $R0 "${MOD_RKEY}"
; Setup-Parameter in die Registrierung schreiben
ClearErrors
WriteRegExpandStr HKLM $R0 "InstallLocation" $INSTDIR
IfErrors "" write
MessageBox MB_OK|MB_ICONSTOP "Beim Schreiben der Werte für die spätere Deinstallation trat ein Fehler auf.$\r$\nStellen Sie sicher, dass Ihr Benutzerkonto über die notwendigen Rechte verfügt.$\r$\n$\r$\n(HKLM\$R0)"
Pop $R0
Abort
write:
WriteRegDWORD HKLM $R0 "VersionMajor" ${VER_MAJOR}
WriteRegDWORD HKLM $R0 "VersionMinor" ${VER_MINOR}
WriteRegDWORD HKLM $R0 "VersionPatch" ${VER_PATCH}
WriteRegDWORD HKLM $R0 "VersionFlags" ${VER_FLAGS}
WriteRegStr HKLM $R0 "DisplayIcon" "$INSTDIR\System\Gothic2.exe,0"
WriteRegStr HKLM $R0 "DisplayName" "${MOD_NAME}"
WriteRegStr HKLM $R0 "DisplayVersion" "${VER_TEXT}"
WriteRegDWORD HKLM $R0 "NoModify" 1
WriteRegDWORD HKLM $R0 "NoRepair" 1
WriteRegExpandStr HKLM $R0 "UninstallString" "$INSTDIR\${MOD_FILE}-uninst.exe"
WriteRegStr HKLM $R0 "Publisher" "${MOD_COMP}"
WriteRegStr HKLM $R0 "URLInfoAbout" "${MOD_LINK}"
WriteRegStr HKLM $R0 "HelpLink" "${MOD_HELP}"
Pop $R0
SectionEnd
;-------------------------------------------------------------------------------
;
; Modifikation
;
; Installer
LangString NameSecModFiles ${LANG_GERMAN} "${MOD_NAME}"
LangString TextSecModFiles ${LANG_GERMAN} "Installiere ${MOD_NAME}..."
Section !$(NameSecModFiles) SecModFiles
SectionIn RO ; nicht abwählbar
SetDetailsPrint textonly
DetailPrint $(TextSecModFiles)
SetDetailsPrint listonly
SetOverwrite on
; Installiere Mod-Konfiguration
SetOutPath "$INSTDIR\System"
File ".\install\System\${MOD_FILE}.ini"
; Installiere Mod-Volume
SetOutPath "$INSTDIR\Data\modvdf"
File ".\install\Data\modvdf\${MOD_FILE}.mod"
; Eventuelles Mod-Volume in /Data entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\${MOD_FILE}.mod"
; Einträge im Startmenü
SetShellVarContext current
!insertmacro g2mod_CreateDirectory "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen"
CreateShortCut "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME}.lnk" \
"$INSTDIR\System\GothicStarter.exe" "-game:${MOD_FILE}.ini"
CreateShortCut "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME} entfernen.lnk" \
"$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
; Uninstaller
Section !un.$(NameSecModFiles) unSecModFiles
SectionIn RO ; nicht abwählbar
; Mod-Volume und Mod-Volume-Map entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\vdfs_${MOD_FILE}.dmp"
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\${MOD_FILE}.mod"
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\modvdf\${MOD_FILE}.mod"
; /Data/modvdf wird nur entfernt, wenn es leer ist
!insertmacro g2mod_RemoveDirectory "$INSTDIR\Data\modvdf"
; Mod-Konfiguration entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\System\${MOD_FILE}.ini"
; Einträge im Startmenü entfernen
SetShellVarContext current
!insertmacro g2mod_DeleteFile "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME}.lnk"
!insertmacro g2mod_DeleteFile "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME} entfernen.lnk"
; Werden nur entfernt, falls die Verzeihcnisse leer sind...
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen"
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD\Gothic II"
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD"
SectionEnd
;-------------------------------------------------------------------------------
;
; Spielstände
;
LangString NameSecModSaves ${LANG_GERMAN} "Spielstände von ${MOD_NAME}"
; Installer (nicht angezeigt)
Section -$(NameSecModSaves) SecModSaves
; Mod-Savegame Verzeichnis anlegen
!insertmacro g2mod_CreateDirectory "$INSTDIR\saves_${MOD_FILE}\current"
SectionEnd
; Uninstaller
Section un.$(NameSecModSaves) unSecModSaves
; Mod-Savegames entfernen
RMDir /r "$INSTDIR\saves_${MOD_FILE}"
SectionEnd
;-------------------------------------------------------------------------------
;
; Cleanup (nicht angezeigt)
;
; Installer
Section -post
SetDetailsPrint none
; Uninstaller schreiben
Delete "$INSTDIR\${MOD_FILE}-uninst.exe"
WriteUninstaller "$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
; Uninstaller
Section -un.post
SetDetailsPrint none
; Registrierungsdaten entfernen
DeleteRegKey HKLM "${MOD_RKEY}"
; Uninstaller entfernen
Delete "$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
;===============================================================================
;
; Player-Kit
;
Section -g2mpk
SetOverwrite on
SetDetailsPrint none
SetShellVarContext current
!insertmacro g2mod_InstallPlayerKit
SectionEnd
;===============================================================================
;
; Callback-Funktionen
;
; Installer (Init)
Function .onInit
Push $R0
SetCurInstType 0
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "setup.ini"
; Kein 'unsichtbares' Setup
SetSilent normal
; $INSTDIR bereits gültig?
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Sonst Add-ON Installation suchen (Registrierung)
Call g2mod_GetInstallLocation
Pop $R0
StrCmp $R0 "" done
; Ãœbernehmen
StrCpy $INSTDIR $R0
done:
Pop $R0
FunctionEnd
; Uninstaller (Init)
Function un.onInit
Push $R0
; $INSTDIR gültig?
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Mod-Installation suchen (Registrierung)
ReadRegStr $R0 HKLM "${MOD_RKEY}" "InstallLocation"
StrCmp $R0 "" wrong
StrCpy $INSTDIR $R0
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Nicht gefunden...
wrong:
MessageBox MB_YESNO|MB_ICONQUESTION "Das Installationsverzeichnis scheint ungültig zu sein.$\r$\nSoll die Deinstallation trotzdem fortgesetzt werden?" IDYES done
Pop $R0
Abort
done:
Pop $R0
FunctionEnd
; Reinstall
LangString TextReinstTitle ${LANG_GERMAN} "Vorherige Installation"
LangString TextReinstHead1 ${LANG_GERMAN} "Wählen Sie aus, wie $(^Name) installiert werden soll."
LangString TextReinstOpt1A ${LANG_GERMAN} "Vorher deinstallieren"
LangString TextReinstOpt1B ${LANG_GERMAN} "Nicht deinstallieren"
LangString TextReinstHead2 ${LANG_GERMAN} "Wählen Sie die auszuführende Wartungsoption aus."
LangString TextReinstOpt2A ${LANG_GERMAN} "Erneut installieren"
LangString TextReinstOpt2B ${LANG_GERMAN} "$(^Name) deinstallieren"
LangString TextReinstWrong ${LANG_GERMAN} "Eine inkompatible Version ist bereits installiert!\r\nWenn Sie diese Version wirklich installieren wollen,\r\nsollten Sie die aktuelle Version vorher deinstallieren."
LangString TextReinstOlder ${LANG_GERMAN} "Eine ältere Version ist auf Ihrem System installiert.\r\nEs wird empfohlen die aktuelle Version vorher zu deinstallieren."
LangString TextReinstNewer ${LANG_GERMAN} "Eine neuere Version ist bereits auf Ihrem System installiert!\r\nEs wird empfohlen die ältere Version nicht zu installieren. Wenn Sie diese ältere Version wirklich installieren wollen, sollten Sie die aktuelle Version vorher deinstallieren."
LangString TextReinstEqual ${LANG_GERMAN} "$(^Name) ist bereits installiert."
Function PageReinstall
; Installationsverzeichnis lesen
ReadRegStr $R0 HKLM "${MOD_RKEY}" "InstallLocation"
StrCmp $R0 "" 0 +2
Abort
; Version überprüfen
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionFlags"
IntCmp $R0 ${VER_FLAGS} major wrong wrong
major:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionMajor"
IntCmp $R0 ${VER_MAJOR} minor older newer
minor:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionMinor"
IntCmp $R0 ${VER_MINOR} patch older newer
patch:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionPatch"
IntCmp $R0 ${VER_PATCH} equal older newer
wrong:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstWrong)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
older:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstOlder)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
newer:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstNewer)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
equal:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstEqual)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt2A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt2B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead2)"
StrCpy $R0 "2"
start:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "setup.ini"
FunctionEnd
Function PageLeaveReinstall
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "setup.ini" "Field 2" "State"
StrCmp $R0 "1" 0 +2
StrCmp $R1 "1" inst done
StrCmp $R0 "2" 0 +3
StrCmp $R1 "1" done inst
inst:
HideWindow
ReadRegStr $R1 HKLM "${MOD_RKEY}" "UninstallString"
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
IfErrors nope
IfFileExists $R1 "" nope
Delete $R1
nope:
StrCmp $R0 "2" 0 +2
Quit
BringToFront
done:
FunctionEnd
; Installer (Verzeichnisprüfung)
Var VerifyMessageOnce
Function .onVerifyInstDir
; Version 2.6 deutsch installiert ?
!insertmacro g2mod_IfInstallVersion $INSTDIR "2.6.0.0" done
; Basisversion 2.6 ?
!insertmacro g2mod_IfInstallVersionBase $INSTDIR "2.6" code
Goto nope
code:
; Deutsche Version ?
!insertmacro g2mod_IfInstallVersionCode $INSTDIR 0 done
; Keine 2.6-er (deutsch)...
nope:
; Meldung nur einmalig anzeigen
StrCmp $VerifyMessageOnce "done" +3
MessageBox MB_OK|MB_ICONINFORMATION "Wählen Sie das Verzeichnis aus, in welchem sich 'Gothic II - Die Nacht des Raben' 2.6 (deutsch) befindet."
StrCpy $VerifyMessageOnce "done"
Abort
done:
FunctionEnd
ZmAn3
13th October 2008 22:56 UTC
hmm in your nsi file do u use !include "MUI2.nsh" or just mui?
stopasking
14th October 2008 00:14 UTC
i used !include "MUI.nsh"...i changed it into !include "MUI2.nsh" after u asked, but then an error message comes:
Error in macro MUI_RESERVEFILE_INSTALLOPTIONS on macroline 3
(line120)
ZmAn3
14th October 2008 01:40 UTC
not sure why that happens mabey someone else knows that will read this but mui2 is the include that all the current examples use you might want to use nsdialogs instead of install options its faster if i have time tommarow ill rewite your script but mabey someone can answer your install oprtions question before that this is a line from the mui depreceated.nsh file !error "MUI_RESERVEFILE_INSTALLOPTIONS is no longer supported as InstallOptions is no longer used by MUI2. Instead, use ReserveFile '${MUI_DOLLAR}{NSISDIR}\Plugins\InstallOptions.dll'. It is also recommended to upgrade to nsDialogs." so you can try that ReserveFile and see if that helps
stopasking
14th October 2008 15:13 UTC
well im really a beginner in NSIS, i dont know how to try it with the reservefile (I think it will help, but i dont know how to put that reservefile into the script)...it would be great if u could rewrite the script :)
ZmAn3
14th October 2008 20:08 UTC
ok this seems to work in your script where you have
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS replace it with
ReserveFile ${NSISDIR}\Plugins\InstallOptions.dll
Comperio
14th October 2008 20:18 UTC
From ZmAn3
I'm not sure why that happens mabey someone else knows...
MUI2 uses nsDialogs, not InstallOptions (INI files) for displaying pages. I think the reason for the error is that all the InstallOptions code handling has been removed from MUI2 and put in the InstallOptions.nsh header.
ZmAn3
14th October 2008 20:19 UTC
you can still use installoptions with mui2 thou i just did it
stopasking
14th October 2008 20:29 UTC
Originally posted by ZmAn3
ok this seems to work in your script where you have
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS replace it with
ReserveFile ${NSISDIR}\Plugins\InstallOptions.dll
thanks,
i tried
ReserveFile "setup.ini"
!insertmacro ReserveFile ${NSISDIR}\Plugins\InstallOptions.dll
and
ReserveFile "setup.ini"
ReserveFile ${NSISDIR}\Plugins\InstallOptions.dll
and
ReserveFile "setup.ini"
${NSISDIR}\Plugins\InstallOptions.dll
all three dont work :(
(still error in that line...)
ZmAn3
14th October 2008 21:37 UTC
the second one ReserveFile ${NSISDIR}\Plugins\InstallOptions.dll
what error does that give you
stopasking
14th October 2008 22:27 UTC
ReserveFile: "C:\Program" -> no files found.
Usage: ReserveFile [/nonfatal] [/r] [/x filespec [...]] file [file...]
Error in script "C:\Program Files\JoWooD\Gothic II\_work\demo\setup.nsi" on line 121 -- aborting creation process
_____________
maybe because i dont have that reservefile on my pc?
ZmAn3
14th October 2008 23:00 UTC
its not finding the file then thats why it says that look for the installoptions dll in your nsis directory and just copy it to the same directory as your script then change that line to ReserveFile InstallOptions.dll
kukomamasan
15th October 2008 01:49 UTC
NSIS still using old dos 8.3 formats i think, and need "filename" if its over 8.3 or spaces in the path, like program files (thats what i get from that error ( ReserveFile: "C:\Program" -> no files found.)
maybe ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll" will help ?
stopasking
15th October 2008 11:58 UTC
OK guys, thanks a lot, now the errors have gone :D (there were some more errors after that one, but i could fix them :))
is it also possible to put the bmp in the uninstaller?
here's my new script again...
;===============================================================================
;
; G2MDK - DemoMod Setup-Script
;
; System: NSIS 2.0 http://nsis.sf.net/
; Editor: HMNE 2.0 http://hmne.sf.net/
;
;===============================================================================
; Kompressionseinstellungen
CRCCheck force
;SetCompressor lzma
;SetCompressorDictSize 128 ; LZMA-Speicherverbrauch, siehe Tabelle
; DictSize Compress Decomp
; 8 MB 141 MB 10 MB (default)
; 12 MB 179 MB 14 MB
; 16 MB 217 MB 18 MB
; 24 MB 293 MB 26 MB
; 32 MB 369 MB 35 MB
; 48 MB 521 MB 50 MB
; 64 MB 673 MB 66 MB
; 96 MB 977 MB 98 MB
; 128 MB 1281 MB 130 MB
; 192 MB 1889 MB 194 MB
;!packhdr "packhdr.tmp" "upx.exe --best packhdr.tmp" ; http://upx.sf.net/
; Definitionen
; TODO: Version der Modifikation
!define VER_MAJOR 1 ; Major Version
!define VER_MINOR 0 ; Minor Version
!define VER_PATCH 0 ; Patch-Version (1=a, ...)
!define VER_FLAGS 0 ; Sprachversion
!define VER_FILE "${VER_MAJOR}.${VER_MINOR}"
!define VER_TEXT "${VER_MAJOR}.${VER_MINOR}"
; TODO: Eigenschaften der Modifikation
!define MOD_FILE "Orkherrschaft" ; Mod-Dateiname (KEINE Leer- oder Sonderzeichen!)
!define MOD_NAME "Orkherrschaft" ; Mod-Titel
!define MOD_COPY "Copyright © 2004, Pluto 13 GmbH" ; Mod-Copyright
!define MOD_COMP "SunStars" ; Mod-Herausgeber
!define MOD_LINK "http://sunstars.worldofgothic.com" ; Herausgeber-Link
!define MOD_HELP "http://www.worldofgothic.de" ; Support-Link
;===============================================================================
;
; MUI
;
!include "MUI2.nsh"
Name "${MOD_NAME} ${VER_TEXT}"
OutFile "${MOD_FILE}-${VER_FILE}.exe"
InstallDir "$PROGRAMFILES\JoWooD\Gothic II\"
!define MOD_RKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_NAME}"
InstallDirRegKey HKLM "${MOD_RKEY}" "InstallLocation"
AllowRootDirInstall true
; Konfiguration (Installer)
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "Dieser Assistent wird Sie durch die Installation von $(^Name) begleiten.\r\n\r\nEs wird empfohlen vor der Installation alle anderen Programme zu schließen.\r\n\r\n$_CLICK"
!define MUI_COMPONENTSPAGE_NODESC
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Documents and Settings\a\My Documents\NSIS_Menu.bmp"
; Setup-Seiten (Installer)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ".\setup\licence.rtf"
Page custom PageReinstall PageLeaveReinstall
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
; Konfiguration (Uninstaller)
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "Dieser Assistent wird Sie durch die Deinstallation von $(^Name) begleiten.\r\n\r\nBitte beenden Sie Gothic II und zugehörige Tools,\r\nbevor Sie mit der Deinstallation fortfahren.\r\n\r\n$_CLICK"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_TITLE_3LINES
; Setup-Seiten (Uninstaller)
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
; Setup-Sprache
!insertmacro MUI_LANGUAGE "German"
; Reservierte Dateien
ReserveFile "setup.ini"
ReserveFile "C:\Program Files\NSIS\Plugins\InstallOptions.dll"
;===============================================================================
;
; Installer
;
; Setup.exe Versionsinformationen (Sprache = MUI_LANGUAGE)
VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}.${VER_FLAGS}"
VIAddVersionKey "CompanyName" "${MOD_COMP}"
VIAddVersionKey "FileVersion" "${VER_TEXT}"
VIAddVersionKey "LegalCopyright" "${MOD_COPY}"
VIAddVersionKey "FileDescription" "${MOD_NAME}"
VIAddVersionKey "OriginalFilename" "${MOD_FILE}-${VER_FILE}.exe"
LangString NameInstFull ${LANG_GERMAN} "Vollständig"
InstType $(NameInstFull)
!include ".\setup\g2mod.nsh"
;-------------------------------------------------------------------------------
;
; Init (nicht angezeigt)
;
; Installer
Section -pre
Push $R0
SetDetailsPrint none
StrCpy $R0 "${MOD_RKEY}"
; Setup-Parameter in die Registrierung schreiben
ClearErrors
WriteRegExpandStr HKLM $R0 "InstallLocation" $INSTDIR
IfErrors "" write
MessageBox MB_OK|MB_ICONSTOP "Beim Schreiben der Werte für die spätere Deinstallation trat ein Fehler auf.$\r$\nStellen Sie sicher, dass Ihr Benutzerkonto über die notwendigen Rechte verfügt.$\r$\n$\r$\n(HKLM\$R0)"
Pop $R0
Abort
write:
WriteRegDWORD HKLM $R0 "VersionMajor" ${VER_MAJOR}
WriteRegDWORD HKLM $R0 "VersionMinor" ${VER_MINOR}
WriteRegDWORD HKLM $R0 "VersionPatch" ${VER_PATCH}
WriteRegDWORD HKLM $R0 "VersionFlags" ${VER_FLAGS}
WriteRegStr HKLM $R0 "DisplayIcon" "$INSTDIR\System\Gothic2.exe,0"
WriteRegStr HKLM $R0 "DisplayName" "${MOD_NAME}"
WriteRegStr HKLM $R0 "DisplayVersion" "${VER_TEXT}"
WriteRegDWORD HKLM $R0 "NoModify" 1
WriteRegDWORD HKLM $R0 "NoRepair" 1
WriteRegExpandStr HKLM $R0 "UninstallString" "$INSTDIR\${MOD_FILE}-uninst.exe"
WriteRegStr HKLM $R0 "Publisher" "${MOD_COMP}"
WriteRegStr HKLM $R0 "URLInfoAbout" "${MOD_LINK}"
WriteRegStr HKLM $R0 "HelpLink" "${MOD_HELP}"
Pop $R0
SectionEnd
;-------------------------------------------------------------------------------
;
; Modifikation
;
; Installer
LangString NameSecModFiles ${LANG_GERMAN} "${MOD_NAME}"
LangString TextSecModFiles ${LANG_GERMAN} "Installiere ${MOD_NAME}..."
Section !$(NameSecModFiles) SecModFiles
SectionIn RO ; nicht abwählbar
SetDetailsPrint textonly
DetailPrint $(TextSecModFiles)
SetDetailsPrint listonly
SetOverwrite on
; Installiere Mod-Konfiguration
SetOutPath "$INSTDIR\System"
File ".\install\System\${MOD_FILE}.ini"
; Installiere Mod-Volume
SetOutPath "$INSTDIR\Data\modvdf"
File ".\install\Data\modvdf\${MOD_FILE}.mod"
; Eventuelles Mod-Volume in /Data entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\${MOD_FILE}.mod"
; Einträge im Startmenü
SetShellVarContext current
!insertmacro g2mod_CreateDirectory "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen"
CreateShortCut "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME}.lnk" \
"$INSTDIR\System\GothicStarter.exe" "-game:${MOD_FILE}.ini"
CreateShortCut "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME} entfernen.lnk" \
"$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
; Uninstaller
Section !un.$(NameSecModFiles) unSecModFiles
SectionIn RO ; nicht abwählbar
; Mod-Volume und Mod-Volume-Map entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\vdfs_${MOD_FILE}.dmp"
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\${MOD_FILE}.mod"
!insertmacro g2mod_DeleteFile "$INSTDIR\Data\modvdf\${MOD_FILE}.mod"
; /Data/modvdf wird nur entfernt, wenn es leer ist
!insertmacro g2mod_RemoveDirectory "$INSTDIR\Data\modvdf"
; Mod-Konfiguration entfernen
!insertmacro g2mod_DeleteFile "$INSTDIR\System\${MOD_FILE}.ini"
; Einträge im Startmenü entfernen
SetShellVarContext current
!insertmacro g2mod_DeleteFile "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME}.lnk"
!insertmacro g2mod_DeleteFile "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen\${MOD_NAME} entfernen.lnk"
; Werden nur entfernt, falls die Verzeihcnisse leer sind...
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD\Gothic II\Modifikationen"
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD\Gothic II"
!insertmacro g2mod_RemoveDirectory "$SMPROGRAMS\JoWooD"
SectionEnd
;-------------------------------------------------------------------------------
;
; Spielstände
;
LangString NameSecModSaves ${LANG_GERMAN} "Spielstände von ${MOD_NAME}"
; Installer (nicht angezeigt)
Section -$(NameSecModSaves) SecModSaves
; Mod-Savegame Verzeichnis anlegen
!insertmacro g2mod_CreateDirectory "$INSTDIR\saves_${MOD_FILE}\current"
SectionEnd
; Uninstaller
Section un.$(NameSecModSaves) unSecModSaves
; Mod-Savegames entfernen
RMDir /r "$INSTDIR\saves_${MOD_FILE}"
SectionEnd
;-------------------------------------------------------------------------------
;
; Cleanup (nicht angezeigt)
;
; Installer
Section -post
SetDetailsPrint none
; Uninstaller schreiben
Delete "$INSTDIR\${MOD_FILE}-uninst.exe"
WriteUninstaller "$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
; Uninstaller
Section -un.post
SetDetailsPrint none
; Registrierungsdaten entfernen
DeleteRegKey HKLM "${MOD_RKEY}"
; Uninstaller entfernen
Delete "$INSTDIR\${MOD_FILE}-uninst.exe"
SectionEnd
;===============================================================================
;
; Player-Kit
;
Section -g2mpk
SetOverwrite on
SetDetailsPrint none
SetShellVarContext current
!insertmacro g2mod_InstallPlayerKit
SectionEnd
;===============================================================================
;
; Callback-Funktionen
;
; Installer (Init)
Function .onInit
Push $R0
SetCurInstType 0
!include "Installoptions.nsh"
!insertmacro INSTALLOPTIONS_EXTRACT "setup.ini"
; Kein 'unsichtbares' Setup
SetSilent normal
; $INSTDIR bereits gültig?
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Sonst Add-ON Installation suchen (Registrierung)
Call g2mod_GetInstallLocation
Pop $R0
StrCmp $R0 "" done
; Ãœbernehmen
StrCpy $INSTDIR $R0
done:
Pop $R0
FunctionEnd
; Uninstaller (Init)
Function un.onInit
Push $R0
; $INSTDIR gültig?
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Mod-Installation suchen (Registrierung)
ReadRegStr $R0 HKLM "${MOD_RKEY}" "InstallLocation"
StrCmp $R0 "" wrong
StrCpy $INSTDIR $R0
IfFileExists "$INSTDIR\System\Gothic2.exe" done
; Nicht gefunden...
wrong:
MessageBox MB_YESNO|MB_ICONQUESTION "Das Installationsverzeichnis scheint ungültig zu sein.$\r$\nSoll die Deinstallation trotzdem fortgesetzt werden?" IDYES done
Pop $R0
Abort
done:
Pop $R0
FunctionEnd
; Reinstall
LangString TextReinstTitle ${LANG_GERMAN} "Vorherige Installation"
LangString TextReinstHead1 ${LANG_GERMAN} "Wählen Sie aus, wie $(^Name) installiert werden soll."
LangString TextReinstOpt1A ${LANG_GERMAN} "Vorher deinstallieren"
LangString TextReinstOpt1B ${LANG_GERMAN} "Nicht deinstallieren"
LangString TextReinstHead2 ${LANG_GERMAN} "Wählen Sie die auszuführende Wartungsoption aus."
LangString TextReinstOpt2A ${LANG_GERMAN} "Erneut installieren"
LangString TextReinstOpt2B ${LANG_GERMAN} "$(^Name) deinstallieren"
LangString TextReinstWrong ${LANG_GERMAN} "Eine inkompatible Version ist bereits installiert!\r\nWenn Sie diese Version wirklich installieren wollen,\r\nsollten Sie die aktuelle Version vorher deinstallieren."
LangString TextReinstOlder ${LANG_GERMAN} "Eine ältere Version ist auf Ihrem System installiert.\r\nEs wird empfohlen die aktuelle Version vorher zu deinstallieren."
LangString TextReinstNewer ${LANG_GERMAN} "Eine neuere Version ist bereits auf Ihrem System installiert!\r\nEs wird empfohlen die ältere Version nicht zu installieren. Wenn Sie diese ältere Version wirklich installieren wollen, sollten Sie die aktuelle Version vorher deinstallieren."
LangString TextReinstEqual ${LANG_GERMAN} "$(^Name) ist bereits installiert."
Function PageReinstall
; Installationsverzeichnis lesen
ReadRegStr $R0 HKLM "${MOD_RKEY}" "InstallLocation"
StrCmp $R0 "" 0 +2
Abort
; Version überprüfen
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionFlags"
IntCmp $R0 ${VER_FLAGS} major wrong wrong
major:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionMajor"
IntCmp $R0 ${VER_MAJOR} minor older newer
minor:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionMinor"
IntCmp $R0 ${VER_MINOR} patch older newer
patch:
ReadRegDWORD $R0 HKLM "${MOD_RKEY}" "VersionPatch"
IntCmp $R0 ${VER_PATCH} equal older newer
wrong:
!include "Installoptions.nsh"
/*
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstWrong)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
older:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstOlder)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
newer:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstNewer)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
equal:
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstEqual)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt2A)"
!insertmacro MUI_INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt2B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead2)"
StrCpy $R0 "2"
start:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "setup.ini"
*/
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstWrong)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
older:
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstOlder)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
newer:
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstNewer)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt1A)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt1B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead1)"
StrCpy $R0 "1"
Goto start
equal:
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 1" "Text" "$(TextReinstEqual)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 2" "Text" "$(TextReinstOpt2A)"
!insertmacro INSTALLOPTIONS_WRITE "setup.ini" "Field 3" "Text" "$(TextReinstOpt2B)"
!insertmacro MUI_HEADER_TEXT "$(TextReinstTitle)" "$(TextReinstHead2)"
StrCpy $R0 "2"
start:
!insertmacro INSTALLOPTIONS_DISPLAY "setup.ini"
FunctionEnd
Function PageLeaveReinstall
!include "Installoptions.nsh"
!insertmacro INSTALLOPTIONS_READ $R1 "setup.ini" "Field 2" "State"
StrCmp $R0 "1" 0 +2
StrCmp $R1 "1" inst done
StrCmp $R0 "2" 0 +3
StrCmp $R1 "1" done inst
inst:
HideWindow
ReadRegStr $R1 HKLM "${MOD_RKEY}" "UninstallString"
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
IfErrors nope
IfFileExists $R1 "" nope
Delete $R1
nope:
StrCmp $R0 "2" 0 +2
Quit
BringToFront
done:
FunctionEnd
; Installer (Verzeichnisprüfung)
Var VerifyMessageOnce
Function .onVerifyInstDir
; Version 2.6 deutsch installiert ?
!insertmacro g2mod_IfInstallVersion $INSTDIR "2.6.0.0" done
; Basisversion 2.6 ?
!insertmacro g2mod_IfInstallVersionBase $INSTDIR "2.6" code
Goto nope
code:
; Deutsche Version ?
!insertmacro g2mod_IfInstallVersionCode $INSTDIR 0 done
; Keine 2.6-er (deutsch)...
nope:
; Meldung nur einmalig anzeigen
StrCmp $VerifyMessageOnce "done" +3
MessageBox MB_OK|MB_ICONINFORMATION "Wählen Sie das Verzeichnis aus, in welchem sich 'Gothic II - Die Nacht des Raben' 2.6 (deutsch) befindet."
StrCpy $VerifyMessageOnce "done"
Abort
done:
FunctionEnd
_________
if u could tell me where to put that line in, then everything would be fine with the installer^^
ah yes and one more thing, maybe u guys can help:
i want to put a logo too on the desktop of the users. what do i have to write in the script and where?
stopasking
15th October 2008 18:36 UTC
ah sorry, ok lets leave my questions of the last post out for a moment, coz i want to make something else first:
1.) Is there a possibility to write something else on the top of the window (where Orkherrschaft 1.0 Installation is written?) and also something else on the buttons...?
2.) I wanna play a sound on the start of the installation. how to do it?
thanks :)