nduboc@ilog.fr
20th January 2006 15:57 UTC
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
20th January 2006 18:29 UTC
Here is what you must do:
!macro foo msg
MessageBox MB_OK '${msg}'
!macroend
Function foobar
MessageBox MB_OK "$\""
!insertmacro foo "$\""
FunctionEnd
deguix
20th January 2006 19:37 UTC
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.
nduboc
23rd January 2006 12:50 UTC
OK. Understood.
Thanks for your replies.