diff --git a/Examples/LogicLib.nsi b/Examples/LogicLib.nsi index 495754dd..b9db48b9 100644 --- a/Examples/LogicLib.nsi +++ b/Examples/LogicLib.nsi @@ -137,14 +137,16 @@ Section /o "Run tests" TESTS DetailPrint "FAILED IfThen test" ${EndIf} - ; ifcmd..||..| + ; ifcmd..||..| and if/unless cmd StrCpy $R2 "" ${ifcmd} MessageBox MB_YESNO "Please press Yes" IDYES ${||} StrCpy $R2 $R2A ${|} - ${ifcmd} MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES ${||} StrCpy $R2 $R2B ${|} - ${If} $R2 == "A" - DetailPrint "PASSED IfCmd test" + ${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please press No" IDYES` + StrCpy $R2 $R2B + ${EndUnless} + ${If} $R2 == "AB" + DetailPrint "PASSED IfCmd/If Cmd test" ${Else} - DetailPrint "FAILED IfCmd test" + DetailPrint "FAILED IfCmd/If Cmd test" ${EndIf} ; select..case..case2..case3..case4..case5..caseelse..endselect diff --git a/Include/LogicLib.nsh b/Include/LogicLib.nsh index a60b727d..2bc3c548 100644 --- a/Include/LogicLib.nsh +++ b/Include/LogicLib.nsh @@ -262,15 +262,22 @@ ; "Any instruction" test !macro _Cmd _a _b _t _f !define _t=${_t} - !ifdef _t= - !define __t +2 ; If no jump then make sure we skip the Goto below + !ifdef _t= ; If no true label then make one + !define __t _${__LINE__} !else !define __t ${_t} !endif - !undef _t=${_t} ${_b} ${__t} + !define _f=${_f} + !ifndef _f= ; If a false label then go there + Goto ${_f} + !endif + !undef _f=${_f} + !ifdef _t= ; If we made our own true label then place it + ${__t}: + !endif !undef __t - Goto ${_f} + !undef _t=${_t} !macroend !define Cmd `"" Cmd`