轉(zhuǎn)自 http://hi.csdn.net/jinglidong

!include "LogicLib.nsh"
使用 NSIS 的宏來(lái)提供各種邏輯基本語(yǔ)句,不需要預(yù)先添加函數(shù)。
  • 基本語(yǔ)句

If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless
- 有條件的執(zhí)行一個(gè)語(yǔ)句區(qū)塊,取決于表達(dá)式。

AndIf|AndUnless|OrIf|OrUnless
- 給 If、Unless、ElseIf 和 ElseUnless 增加額外的條件語(yǔ)句。

IfThen..|..|
- 有條件的執(zhí)行一個(gè)內(nèi)聯(lián)語(yǔ)句,取決于表達(dá)式。

IfCmd..||..|
- 條件的執(zhí)行一個(gè)內(nèi)聯(lián)語(yǔ)句,取決于 NSIS 函數(shù)提供的真值。

Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect
- 執(zhí)行多個(gè)語(yǔ)句區(qū)塊之一,取決于表達(dá)式的值。

Switch..{Case|CaseElse|Default}..EndSwitch
- 跳轉(zhuǎn)到多個(gè)標(biāo)記之一,取決于表達(dá)式的值。

Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]
- 重復(fù)一個(gè)語(yǔ)句區(qū)塊直到停止 取決于表達(dá)式的值。

While..{ExitWhile|Continue|Break}..EndWhile
- DoWhile..Loop的別名(向后兼容)

For[Each]..{ExitFor|Continue|Break}..Next
- 重復(fù)語(yǔ)句區(qū)塊來(lái)連續(xù)改變變量的值。

  • 表達(dá)式

標(biāo)準(zhǔn)(內(nèi)建的)字串判斷(不區(qū)分大小寫):
a == b; a != b

另外的不區(qū)分大小寫的字串判斷(使用 System.dll):
a S< b; a S>= b; a S> b; a S<= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP

區(qū)分大小寫字串判斷(使用 System.dll):
a S== b; a S!= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP

標(biāo)準(zhǔn)(內(nèi)建的)有符號(hào)整數(shù)判斷:
a = b; a <> b; a < b; a >= b; a > b; a <= b

標(biāo)準(zhǔn)(內(nèi)建的)無(wú)符號(hào)整數(shù)判斷:
a U< b; a U>= b; a U> b; a U<= b

64位整數(shù)判斷(使用System.dll):
a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_INT64CMP

內(nèi)建的NSIS標(biāo)記判斷:
${Abort};
${Errors};
${RebootFlag};
${Silent}

內(nèi)建的 NSIS 其它判斷:
${FileExists} a;

任何有條件的 NSIS 指令判斷:
${Cmd} a;

區(qū)段標(biāo)記判斷:
${SectionIsSelected} a;
${SectionIsSectionGroup} a;
${SectionIsSectionGroupEnd} a;
${SectionIsBold} a;
${SectionIsReadOnly} a;
${SectionIsExpanded} a;
${SectionIsPartiallySelected} a;