Sree Ranjani
Sree Ranjani

Reputation: 65

NSIS | Message Box | Displaying Text and Variable

I am new to NSIS and I wanted to show a message with a text and a variable value (mainly for debugging purpose). Please let me know if this can be achieved by the following method

Example: MessageBox MB_OK "Application Name" $VersionNumber

If this method is not correct please suggest an alternative.

Upvotes: 3

Views: 8412

Answers (2)

Anders
Anders

Reputation: 101764

The MessageBox string needs quotes (", ' or `) if it contains spaces.

!define COPYYEAR 2018

Var VersionNumber

Section
StrCpy $VersionNumber "1.2.3.4" ; You will probably read this from somewhere, not hardcode it
MessageBox MB_OK "Application Name $VersionNumber"
MessageBox MB_OK NoSpacesNoQuotesRequired$VersionNumber
MessageBox MB_OK|MB_ICONINFORMATION "Copyright (R) ${COPYYEAR}"
SectionEnd

Upvotes: 1

KennZAney1
KennZAney1

Reputation: 91

If your are just wanting to display the 'OK' button, try this:

MessageBox MB_OK "Application Name= ${VersionNumber}"

References: NSIS MessageBox and Chapter 2: Tutorial: The Basics

Note: The entire message that is to be displayed, including any variables, must be encased in quotes.

Upvotes: 0

Related Questions