Archive: Newbie - Error Using NIS Edit 2.0


Newbie - Error Using NIS Edit 2.0
I barely know what I'm doing, but I tried to use the wizard to create a script file. I clicked all the defaults, yet when compiled, I got the following errors:

Invalid command: InstallOptions::initDialog
Error in macro MUI_INSTALLOPTIONS_INITDIALOG on macroline 5
Error in macro MUI_FUNCTION_WELCOMEPAGE on macroline 45
Error in macro MUI_PAGE_WELCOME on macroline 23
Error in script "C:\Documents and Settings\Owner\Desktop\Untitled 03.nsi" on line 21 -- aborting creation process

Anyone know why this failed?

Thanks,

Matt


If you want to know why, please attach the script to fix it.


Here it is. BTW, I have Winodws XP if it matters.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "My application"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "My company, Inc."
!define PRODUCT_WEB_SITE "http://www.mycompany.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AppMainExe.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "c:\path\to\licence\YourSoftwareLicence.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\AppMainExe.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\My application"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "c:\path\to\file\AppMainExe.exe"
CreateDirectory "$SMPROGRAMS\My application"
CreateShortCut "$SMPROGRAMS\My application\My application.lnk" "$INSTDIR\AppMainExe.exe"
CreateShortCut "$DESKTOP\My application.lnk" "$INSTDIR\AppMainExe.exe"
File "c:\path\to\file\Example.file"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\My application\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\My application\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Example.file"
Delete "$INSTDIR\AppMainExe.exe"

Delete "$SMPROGRAMS\My application\Uninstall.lnk"
Delete "$SMPROGRAMS\My application\Website.lnk"
Delete "$DESKTOP\My application.lnk"
Delete "$SMPROGRAMS\My application\My application.lnk"

RMDir "$SMPROGRAMS\My application"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd


see what I was saying ... :)
The first user says... "..I barely know what I am doing..."

This was exactly my point (in a previous post about how NSIS Modern is really difficult to learn)

When I first used NSIS (~version 1.0 something), I thought..."hey cool, an installation software which looks like a programming language". I didn't know the "techinical" word called "script language".

Anyway, from the classic version 1.98, there is such a huge difference , the user has to kinda re-learn the system... especially the MACROS thing :)

We really :D really :D need to simplify the scripting method to make newbies feel comfortable !!!

That is the idea right...convert everyone to the NSIS faith :D ;)

If not simply the scripting, how about a UI designing software which will run in CONJUNCTION with the NSIS version, like (Innosetup+ISTool)

I know SB 3.0 is under way !...


It looks like there might be something wrong with your NSIS installation. I would try downloading it again and reinstalling.

Vytautas


I think I solved it. The referenced file was not in the right place.

My other question is - I can generate the file that does indeed load the application on my computer. But this program will be on a CD that others will use to install the software. How do I deal with which drive (e.g. D, or E, or...) that the user will have the CD in so the installation can work? Is that somehow automatically embeded?

Thanks,


You can detect the drives using "Detect Drives" function, see it in my signature. You can use StrCpy $EXEDIR $EXEDIR 2 to compare with the function results.


I downloaded your sample script got an error:

invalid script: never had OutFile command got an error:

As I'm new to this, much of your sample went over my head.

As I said, my installation program works from my desktop (thanks to the wizard help). Is it really that much more work to have it work from a CD drive? Could it be made easier to prompt for the drive name from the user? I guess I'm having trouble seeing how your sample can be incorporated into my script. This is what I have:

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "2 Brain Poker"
!define PRODUCT_VERSION "2.0"
!define PRODUCT_PUBLISHER "Schmitz, Inc."
!define PRODUCT_WEB_SITE "http://www.2brainpoker.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\cards1.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "license.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$PROGRAMFILES\cards1.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\2 Brain Poker"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$PROGRAMFILES"
SetOverwrite ifnewer
File "cards1.exe"
CreateDirectory "$SMPROGRAMS\2 Brain Poker"
CreateShortCut "$SMPROGRAMS\2 Brain Poker\2 Brain Poker.lnk" "$PROGRAMFILES\cards1.exe"
CreateShortCut "$DESKTOP\2 Brain Poker.lnk" "$PROGRAMFILES\cards1.exe"
File "hodds.txt"
File "d.txt"
File "hole.txt"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\2 Brain Poker\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\2 Brain Poker\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$PROGRAMFILES\cards1.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$PROGRAMFILES\cards1.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$PROGRAMFILES\hole.txt"
Delete "$PROGRAMFILES\d.txt"
Delete "$PROGRAMFILES\hodds.txt"
Delete "$PROGRAMFILES\cards1.exe"

Delete "$SMPROGRAMS\2 Brain Poker\Uninstall.lnk"
Delete "$SMPROGRAMS\2 Brain Poker\Website.lnk"
Delete "$DESKTOP\2 Brain Poker.lnk"
Delete "$SMPROGRAMS\2 Brain Poker\2 Brain Poker.lnk"

RMDir "$SMPROGRAMS\2 Brain Poker"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd


Actually, it looks like the installation works from a CD drive automatically, without caring which CD drive it is.


you are right
Just 1hour ago i was lost... ...errors.. errors and errors from all script where i did copy+paste. ...investigation was needed. Main issue in my opinion are missing detail in tutorial. Macros are described but not explained. ...and it not so difficult. If you need to use macros please make sure you create nsh and save into Include folder. Your script have include File where macro is defined...thats all :)
..of course, please make sure output file is defined.

https://lh6.googleusercontent.com/_a...macro-nsis.jpg

Originally posted by shantanu_gadgil
The first user says... "..I barely know what I am doing..."

This was exactly my point (in a previous post about how NSIS Modern is really difficult to learn)

When I first used NSIS (~version 1.0 something), I thought..."hey cool, an installation software which looks like a programming language". I didn't know the "techinical" word called "script language".

Anyway, from the classic version 1.98, there is such a huge difference , the user has to kinda re-learn the system... especially the MACROS thing :)

We really :D really :D need to simplify the scripting method to make newbies feel comfortable !!!

That is the idea right...convert everyone to the NSIS faith :D ;)

If not simply the scripting, how about a UI designing software which will run in CONJUNCTION with the NSIS version, like (Innosetup+ISTool)

I know SB 3.0 is under way !...

pepeknamornik: Please don't reply to threads that were closed seven (!!) years ago.