Due to usage of the NSIS Logic Library (implemented by the command
"!include LogicLib.nsh" in the *.nsi sript file) I often encountered constructs, which contain the 3 characters "$", "{" and "}".
Typical examples are:
- ${If}
- ${EndIf}
- ${FileExists}
- ${WordReplace}
- ${SetEnvironmentVariable}
- ${SegmentInit}
- ${SegmentPrePrimary}
But in which cases is it necessary to use these characters and why I can omit these characters in connection with the following instructions:
- CopyFiles
- WriteINIStr
The ones that are like ${something} are variables, set either within NsIS itself, within LogicLib or one of the other included headers, or within PAL, not specific to anywhere else.
The other ones are commands within NSIS, not variables. For more information, check out the NSIS user's manual, particularly chapter 4.
http://nsis.sourceforge.net/Docs/
Is it really so, that for example ${FileExists} is a variable? And if so, where is declared this variable? In the article regarding LogicLib is only mentioned, that the expression ${FileExists} is a condition. And what is the value of this variable ${FileExists}?
Furthermore is in documentation of NSIS a by "VAR = example" declared variable later used as "$example", i.e. without the both characters "{" and "}".
Right, sorry, I was answering from my phone, answered quickly.
${If}...${EndIf} and the variations on those, as well as ${FileExists} are LogicLib conditional statements, to be used as listed on the LogicLib page you linked to.
${WordReplace} is a macro found in the headers, WordFunc.nsh, I believe.
${SetEnvironmentVariable} & ${Segment...} are macros created by PAL.
Whereas CopyFiles and WriteINIStr are instructions within NSIS itself.
You've only explained me the meaning of the expressions, which I listed in my original post. But this explanation not answered my main question, why the 3 characters "$", "{" and "}" are used.
In the meantime I received an understandable answer in the Winamp NSIS forum. The compiler maintains a list of defined symbols, which can be defined using !define. To replace a symbol with its value, use ${SYMBOL}. For more informations please look in chapter 5.4 of the documentation of NSIS.
Other functions like CopyFiles are native functions, which the NSIS compiler "makeNSIS.exe" knows about and they are documented in the main helpfile...
In the chapter E.3.8 WordReplace of the NSIS documentation I found fundamental explanations with respect to the expression ${WordReplace}.
But where can I find some helpful explanations to the following expressions?
Some of those are explained in the manual, others you need to dig in the code for more explanation. Note that the code doesn't have specific explanations of what's it's doing, just generic comments.