LogicLib: Difference between revisions
No edit summary |
(→Expressions: Sectionnames have to be written as contants) |
||
Line 64: | Line 64: | ||
* Section flag tests: | * Section flag tests: | ||
<highlight-nsis> | <highlight-nsis> | ||
${SectionIsSelected} | ${SectionIsSelected} ${secA}; | ||
${SectionIsSectionGroupEnd} | ${SectionIsSectionGroup} ${secA}; | ||
${SectionIsReadOnly} | ${SectionIsSectionGroupEnd} ${secA}; | ||
${SectionIsPartiallySelected} | ${SectionIsBold} ${secA}; | ||
${SectionIsReadOnly} ${secA}; | |||
${SectionIsExpanded} ${secA}; | |||
${SectionIsPartiallySelected} ${secA} | |||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:Flow Control Functions]] | [[Category:Flow Control Functions]] | ||
[[Category:LogicLib]] | [[Category:LogicLib]] |
Revision as of 01:18, 26 November 2006
Description
Logic Lib adds some more familiar flow control and logic to NSI Scripts. Things like if, else, while loops, for loops and similar. It is also known as the NSIS Logic Library.
It is appallingly non-documented, but certainly handy if you want to do anything more than very basic logic without having complete Spaghetti Code.
It was created by dselkirk@hotmail.com and eccles@users.sf.net. Shipped with NSIS is version 2.5, which has not been updated since 2004.
A thread exists for discussion of this on the winamp forums at http://forums.winamp.com/showthread.php?s=&postid=1116241
Some Reference
These have been deduced from actually viewing the header file itself, which has a little help info at the top.
The include file for this is LogicLib.nsh. It can be included with:
!include 'LogicLib.nsh'
Statements
If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless
Conditionally executes a block of statements, depending on the value of an expression.
AndIf|AndUnless|OrIf|OrUnless
Adds any number of extra conditions to If, Unless, ElseIf and ElseUnless statements.
IfThen..|..|
Conditionally executes an inline statement, depending on the value of an expression.
IfCmd..||..|
Conditionally executes an inline statement, depending on a true value of the provided NSIS function.
Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect
Executes one of several blocks of statements, depending on the value of an expression.
Switch..{Case|CaseElse|Default}..EndSwitch
Jumps to one of several labels, depending on the value of an expression.
Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]
Repeats a block of statements until stopped, or depending on the value of an expression.
While..{ExitWhile|Continue|Break}..EndWhile
An alias for DoWhile..Loop (for backwards-compatibility)
For[Each]..{ExitFor|Continue|Break}..Next
Repeats a block of statements varying the value of a variable.
Expressions
The following "expressions" are available:
- Standard (built-in) string tests (which are case-insensitive):
a == b; a != b
- Additional case-insensitive string tests (using System.dll):
a S< b; a S>= b; a S> b; a S<= b
- Case-sensitive string tests (using System.dll):
a S== b; a S!= b
- Standard (built-in) signed integer tests:
a = b; a <> b; a < b; a >= b; a > b; a <= b
- Standard (built-in) unsigned integer tests:
a U< b; a U>= b; a U> b; a U<= b
- 64-bit integer tests (using System.dll):
a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
- Built-in NSIS flag tests:
${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
- Built-in NSIS other tests:
${FileExists} a
Any conditional NSIS instruction test:
${Cmd} a
- Section flag tests:
${SectionIsSelected} ${secA}; ${SectionIsSectionGroup} ${secA}; ${SectionIsSectionGroupEnd} ${secA}; ${SectionIsBold} ${secA}; ${SectionIsReadOnly} ${secA}; ${SectionIsExpanded} ${secA}; ${SectionIsPartiallySelected} ${secA}