Archive: Using If Statements


Using If Statements
Hey guys

I need some help with NSIS. I'm reading some variables from registry and if the variable doesn't exists i need to read it from some other locations in registry.

i'm using ReadRegDWORD command to read registry and this is how my command looks like

ReadRegDWORD $PROGDIR HKCU "Software\Microsoft\Office\9.0\Word\Options" "PROGRAMDIR"

where $PROGDIR is a variable that i have defined in the script

ReadRegDWORD would set this variable as empty if it doesn't find it. so in that case i have to serach it from some other location. for this purpose i tried to use the following statement

${If} $PROGDIR == ""
ReadRegDWORD $PROGDIR HKCU "Software\Microsoft\Office\10.0\Word\Options" "PROGRAMDIR"
${ElseIf} $PROGDIR == ""
ReadRegDWORD $PROGDIR HKCU "Software\Microsoft\Office\11.0\Word\Options" "PROGRAMDIR"
${EndIf}

but while compiling this script i'm getting the error Invalid Command ${If}

Can someone help me to find what i'm doing wrong.

Thanks very much


Add the following at the top of your script:

!include LogicLib.nsh

It works now :) Thanks very much.