Archive: A simple GOTO condition. But howto ?


A simple GOTO condition. But howto ?
Hello Guys,

I would like to add a GOTO into my program with a simple condition IF – ELSE.
Here is a very simple code who I do not understand why it is not functional:

Outfile “ConditionGoto”

Section "Step1"

;Example with a basic condition – read a rek key
ReadRegStr $0 HKLM "Software\7-Zip" "Path"
DetailPrint "$0"
!If $0 == "Lotus Notes 8.52 FP2"
ExecWait "$SYSDIR\Notepad.exe"
DetailPrint "Hello I’m Notepad !"

!Else
DetailPrint "Condition Step1 KO !"
Goto .OK


!EndIf
SectionEnd

Section "Step2"
ExecWait "$SYSDIR\mspaint.exe"
DetailPrint "I’m Paint !"
SectionEnd


Section "CallOK"
.OK:
DetailPrint "Your are in Goto World !
ExecWait "$SYSDIR\calc.exe"
Quit
SectionEnd

For me If condition step1 is OK, notepad start, then paint and calc. Right ?
If step1 is KO, only calc start and the script close.
But is it not right :/

!if !else !endif are precompiler statements. You meant to use LogicLib.nsh and ${If}, ${Else}, ${EndIf}.


Thanks demiller,

It works ! Thank you


${If} etc are also precompiler statements. The problem is that !if is a compiletime command, whereas ${If} is a runtime command.