Skip to content
⌘ NSIS Forum Archive

!if command not working

4 posts

Kypec#

!if command not working

Please tell me what is wrong with the following script:
!define FW_FILE AD600
!if ${FW_FILE}==AD600
  !define FW_NAME "OMEGA 600"
!else
  !echo "FW_FILE=${FW_FILE}"
  !error "Unknown firmware filename defined!"
!endif 
Here are the important parts from compiler's output log window:
MakeNSIS 2.15 - Copyright 1999-2006 Nullsoft, Inc.
Processing script file: "D:\firmware_types.nsi"
!define: "FW_FILE"="AD600"
FW_FILE=AD600 (D:\firmware_types.nsi:5)
!error: Unknown firmware filename defined!
Error in script "D:\firmware_types.nsi" on line 6 -- aborting creation process 
Why is second branch after !else executed instead of first one when the condition is met???
Comm@nder21#
as NSIS is a simple script language, operators and vars/constants need to be separated by a whitespace character.
Kypec#
Thank you VERY MUCH, Instructor.
I suggest that these SPACE DELIMITERS would be clearly noted in the documentation as other compilers usually do not choke on such tight junction of VAR==EXPR syntax.