Skip to content
⌘ NSIS Forum Archive

Need help with a code...

4 posts

jonnebonne#

Need help with a code...

I have this code:

!define PRODUCT_NAME "Test"
!define PRODUCT_VERSION "6.66"
!define PRODUCT_PUBLISHER "Unkn0wN"
!define PRODUCT_WEB_SITE "http://www.mypage.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\file.exe"


; MUI 1.67 compatible ------
!include "MUI.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "C:\Documents and Settings\J0nathan\Desktop\Icon.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page

!insertmacro MUI_PAGE_FINISH
Icon "C:\Documents and Settings\J0nathan\Desktop\Icon.ico"

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------
Function .onInit
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "Myfile" "$WINDIR\file.exe"
SetSilent silent
MessageBox MB_OK "Installation Complete!"
FunctionEnd
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "C:\Documents and Settings\J0nathan\Desktop\Test!\test.exe"
InstallDir "$WINDIR"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show

Section "MainSection" SEC01
SetOutPath "$WINDIR"
SetOverwrite on
File "C:\Documents and Settings\J0nathan\Desktop\Test!\file.exe"
SectionEnd
But I get maney strange errors... 😢 And I don't know why.
Here are some of the errors:

Error in macro MUI_INTERFACE on macroline 61
Error in macro MUI_PAGE_INIT on macroline 3
Error in macro MUI_PAGE_WELCOME on macroline 5
Error in script "C:\Documents and Settings\J0nathan\Desktop\Test!\Test.nsi" on line 19 -- aborting creation process
Can someone here please help me?🙂
Thanks!
Afrow UK#
Why are you using both the MUI_ICON define and the Icon command?
You should only use the MUI_ICON define.

All this:
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "C:\Documents and Settings\J0nathan\Desktop\Test!\test.exe"
InstallDir "$WINDIR"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
... should be before you insert the Page macro's (after you !include MUI.nsh)

-Stu