Archive: Calling macro with double-quote as parameter


Calling macro with double-quote as parameter
  I am trying to call a macro where one of the parameters is a double quote (").

The compiler is rejecting the


macro WordFindFixedCall STR DEL COL RET

${WordFind} "${STR}" "${DEL}" "${COL}" ${RET}
StrCmp "${STR}" "${RET}" 0 +2
StrCpy${RET} ""
>!macroend
>
Tried:


" $0

${WordFindFixed} $2 '$\"' "
+2" $0
${WordFindFixed} $2 "$"" "+2" $0
>
But the compiler complains that there are too many parameters:
Creating NSIS installer
!insertmacro: macro "WordFindCall" requires 4 parameter(s), passed 5!
Error in macro WordFindFixedCall on macroline 1
!include: error in script: "setup_custom_pages_functions.nsh" on line 276
Error in script "installer/setup.nsi" on line 783 -- aborting creation process
Result: 1

Any ideas how I can pass in a double-quote?

Wrap it in single quotes?

${WordFindFixed} $2 '"' "+2" $0


wrapping in single quotes doesn't work either.


When you wrap it in single quotes in the call to the macro ['"'], inside the macro it will be back to just ["]. So in the macro where you use the value it would also need to be wrapped in single quotes.

${WordFind} "${STR}" '${DEL}' "${COL}" ${RET}


In the macro, use ` for the quotes.

Stu


A far more elegant answer, thanks Stu.