Skip to content
⌘ NSIS Forum Archive

insertmacro and escaped quote => bug ?

4 posts

Guest#

insertmacro and escaped quote => bug ?

Hello,

Here is a code fragment :

!macro foo msg
MessageBox MB_OK ${msg}
!macroend

Function foobar
MessageBox MB_OK "$\""
!insertmacro foo "$\""
FunctionEnd
and the compilation error I get :

Function: "foobar"
MessageBox: 0: """
!insertmacro: foo
Error: unterminated string parsing line at macro:foo:1
Error in macro foo on macroline 1
Either there is something I don't understand about how macro parameters are handled or there is a bug in NSIS.
It seems that escaping rules in strings are different for macro parameters than for function calls.
smatte#
Here is what you must do:


!macro foo msg
MessageBox MB_OK '${msg}'
!macroend

Function foobar
MessageBox MB_OK "$\""
!insertmacro foo "$\""
FunctionEnd
deguix#
This is not a bug. You are iserting the double-quote(") character in the MessageBox text parameter and this makes that the parameter be equal to " which still needs an ending " for correct parsing. The $\" is always converted to " - except if reading from files and plug-ins input and output values.

The solution shown by smatte is the correct to insert this character without changes, but you could also use $\$\" as the value to give the original effect you wanted to achieve.