NSIS倍数如果条件

时间:2015-06-18 10:54:04

标签: nsis

我可以在NSIS脚本中实现以下C代码吗?

C代码

if ( (value1 == 1) && ((value2 == "text") || (value3 >= 100)) )
  //Do something

NSIS代码

${If} $value2 == "text"
${OrIf} $value3 >= 100

但我不认为在上述情况下我可以添加另一个${AndIf}语句。相反,我需要做以下事情:

${If} $value1 == 1
    ${If} $value2 == "text"
    ${OrIf} $value3 >= 100
        //Condition success
    ${EndIf}
${Else}
    //Conditon failed
${EndIf}

我是否正确或有更好的方法吗?

4 个答案:

答案 0 :(得分:4)

在一个语句中组合${OrIf}${AndIf}将为您提供未定义的结果,您需要嵌套if语句。我不知道更好的方式......

答案 1 :(得分:0)

;如果有一个可行的例子可以帮助任何人。

!include LogicLib.nsh

Section testSec
    Var /GLOBAL equalsFive

    StrCpy $equalsFive 5

    Var /GLOBAL equalsSix

    StrCpy $equalsSix 6

    Var /GLOBAL equalsSeven

    StrCpy $equalsSeven 7

    ${If} $equalsFive = 5
        ${AndIf} $equalsSix = 8
            ${OrIf} $equalsSeven = 7
                DetailPrint "OrIf Works"
    ${EndIf}
SectionEnd

答案 2 :(得分:0)

ASSUME NEW CONSTANT Participant,
       NEW VARIABLE state,
       NEW CONSTANT p \in Participant,
       NEW CONSTANT b \in Nat,
       /\ state[p][p].maxBal < b
       /\ state'
          = [state EXCEPT
               ![p] = [state[p] EXCEPT
                         ![p] = [state[p][p] EXCEPT !.maxBal = b]]] 
PROVE  [p_1 \in Participant |-> state[p_1][p_1].maxBal]'
       = [[p_1 \in Participant |-> state[p_1][p_1].maxBal] EXCEPT ![p] = b]

尝试此代码

答案 3 :(得分:0)

${If} $value1 == 1
    ${AndIf} $value2 == "text"    ;useAndif
    ${OrIf} $value3 >= 100
        //Condition success
    ${EndIf}
${Else}
    //Conditon failed
${EndIf}