上一頁 | 目錄 | 下一頁
E.4 邏輯函數庫
E.4.1 介紹
包含檔案:
!include "LogicLib.nsh"
使用 NSIS 的宏來提供各種邏輯基本語句,不需要預先新增函數。
E.4.2 基本語句
- If|Unless..{ElseIf|ElseUnless}..[Else]..EndIf|EndUnless
- 有條件的執行一個語句區塊,取決於表達式。
- AndIf|AndUnless|OrIf|OrUnless
- 給 If, Unless, ElseIf 和 ElseUnless 增加額外的條件語句。
- IfThen..|..|
- 有條件的執行一個內聯語句,取決於表達式。
- IfCmd..||..|
- 條件的執行一個內聯語句,取決於 NSIS 函數提供的真值。
- Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect
- 執行多個語句區塊之一,取決於表達式的值。
- Switch..{Case|CaseElse|Default}..EndSwitch
- 轉移到多個標記之一,取決於表達式的值。
- Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until]
- 重複一個語句區塊直到停止 取決於表達式的值。
- While..{ExitWhile|Continue|Break}..EndWhile
- DoWhile..Loop 的別名 (向後兼容)
- For[Each]..{ExitFor|Continue|Break}..Next
- 重複語句區塊來連續改變變量的值。
E.4.3 表達式
- 標準 (內建的) 字串判斷 (不區分大小寫):
a == b; a != b
- 另外的不區分大小寫的字串判斷 (使用 System.dll):
a S< b; a S>= b; a S> b; a S<= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP
- 區分大小寫字串判斷 (使用 System.dll):
a S== b; a S!= b
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_STRCMP
- 標準 (內建的) 有符號整數判斷:
a = b; a <> b; a < b; a >= b; a > b; a <= b
- 標準 (內建的) 無符號整數判斷:
a U< b; a U>= b; a U> b; a U<= b
- 64 位整數判斷 (使用 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
- 內建的 NSIS 標記判斷:
${Abort}; ${Errors}; ${RebootFlag}; ${Silent}
- 內建的 NSIS 其它判斷:
${FileExists} a
- 任何有條件的 NSIS 指令判斷:
${Cmd} a
- 區段標記判斷:
${SectionIsSelected} a; ${SectionIsSectionGroup} a;
${SectionIsSectionGroupEnd} a; ${SectionIsBold} a;
${SectionIsReadOnly} a; ${SectionIsExpanded} a;
${SectionIsPartiallySelected} a
- 需要在 !include LogicLib.nsh 之前 !define LOGICLIB_SECTIONCMP
E.4.4 例子
;見 Examples\LogicLib.nsi
上一頁 | 目錄 | 下一頁