nsdialog example throws exception - nsis

I have been using NSIS (2.33) for and while, but am a newbie with nsDialogs, so am working through the examples at:
http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html
However, once I get to the "Creating Page" example, which adds the lines:
nsDialogs::Create 1018
Pop $Dialog
I then get an exception when I run it.
Trying later examples on the page, these will not even compile, as I get:
Invalid command: ${NSD_Check}
I am cut-and-pasting the examples, so can't see what I'm doing wrong!
Can anyone offer a newbie some advice?

Upgrade to NSIS v2.46 to get the latest version of nsdialogs.nsh along with the bugfixes for plugin itself.

Related

NSIS nsExec path issue perhaps

First time with making an installation file. Using NSIS. Trying to run a nodeJS script command line after installation completes and poking about online suggestions all seem to be a variation of
Section "runNodeJavascript"
nsExec::Exec '"$SYSDIR\cmd.exe" /c
node "c:\Program Files (x86)\FolderOne\FolderTwo\JavascriptToRun.js"'
SectionEnd
But my experimentation so far is for naught, any insight? Everything else with NSIS online has been pretty helpful making a little installer but for some reason hitting a little barrier here...

Electron-builder NSIS, embedding other installers

I have created a little electron program for one of my friends, it is a patcher for a private metin2 server of some sort. The game itself is really old so it requires a few redisturables to be installed.
[dxwebsetup0411 / dotNetFx35setup / vcredist_x86 ( i believe its a 2013 version) ]
I want to include them as an option at the end of the install (or even before it, doesn't really matter).
I have found a few examples how to do so but they are all for Standalone NSIS installers and when i try to include that script ( in the build/installer.nsh file ), the build process crashes, presumably because its not the main build script therefor adding Sections is prohibited (?).
Im really new to NSIS scripts and NSIS overall.
So far i only figured out how to put checkboxes and labels and so on in, with the help of nsDialogs, but as i looked at its documentation, it seemed that there are no option where i could do this.
Any help would be greatly appreciated.
EDIT :
My script currently is almost empty, I only changed the default directory, but anyway here is that:
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Decay2"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Decay2"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Decay2"
WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Decay2"
!macroend
Everything i know about electron-builder's NSIS main script and this included script is here :
Custom Script Example
NSIS- Electron Builder
It is definitely possible to embed other installers and execute them. See this example on SO:
Embedding other installers using NSIS
or these official NSIS tutorials/guides: https://nsis.sourceforge.io/Embedding_other_installers
Please post your script and build file(s) if you have some issue with your script and you expect specific answer.

Nsis ExecWait command under the hood

There's a nsis exe that I know it using Nsis ExecWait to run a process.I need to hook it so I could replace the exe it Exec.
The problem is I'm not sure about what api to hook.And I've try dive into Nsis source codes till now find nothing:(. So Is there anyone familiar with nsis source codes give me some clue so I could find what ExecWait command under the hood API?
ExecWait is currently just CreateProcess+WaitForSingleObject.
In the NSIS source this instruction is called TOK_EXECWAIT in the compiler (script.cpp) and it maps to the EW_EXECUTE opcode in the installer stub (exehead/exec.c)...

NSIS uninstaller doesn't run un.onInit

In my .nsi file I have the following logic in the un.onInit function:
Function un.onInit
MessageBox MB_YESNO "This will uninstall. Continue?" IDYES checkRunning
checkRunning:
FindProcDLL::FindProc "app.exe"
IntCmp $R0 1 0 notRunning
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "${PRODUCT} is running, please close it so the installation can proceed." /SD IDCANCEL IDRETRY checkRunning
Abort
notRunning:
!insertmacro Init "uninstaller"
FunctionEnd
However, the messageBox (and the process is running message) is never shown. So I went through a lot of documentation and apparently running silent mode prevents this method being called so I added SilentInstall normal and SilentUnInstall normal to the .nsi file. However, this doesn't work either.
I tried invoking the uninstaller by manually going to the uninstall.exe and by running the installer which checks if there is already a version installed and if there is calling:
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "UninstallString"
StrCmp $R0 "" done
Abort
Yet both of these invokes do not trigger to 'normal' mode. So how can I get my un.onInit function to be called?
Edit:
As someone asked for the whole file, here it is. I copied the relevant parts only, but if more is needed feel free to check it out. Note that the whole file is already quite old, I am merely updating it.
After upgrading the MUI2 (Modern User Interface 2.0), downgrading to NSIS 2.5 and using the NsProcess plug-in, I got it working. The function is now being called and my check works using the new plugin. The FindProcDLL plugin is broken on NSIS > 2.46

Error installing a font with NSIS

I am working on my first NSIS script and I have it working to install my Windows form project, but now I also want it to install a specific font during the installation. I keep getting the following error, even though my code appears to match every example I can find.
Invalid command: FontName::Name
Error in macro FontName on macroline 3
Error in macro InstallTTFFont on macroline 30
Here is the code I have added for the install of the font:
!include FontReg.nsh
!include FontName.nsh
!include WinMessages.nsh
Section "Fonts"
StrCpy $FONT_DIR $FONTS
!insertmacro InstallTTFFont "myFont-B.TTF"
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
Invalid command: xxx::yyy means it cannot find the xxx plugin. Did you put the FontName plugin .dll in the correct plugin directory?

Resources