Lisasdad
9th June 2005 09:25 UTC
double quoation in macros
Hi,
I need a little helü with double quotation in marcro parameters.
I wrote a macro like this:
!macro CreateShellCommand EXTENSION APPLICATION COMMAND DESCRIPTION ACTION
WriteRegStr HKCR "${APPLICATION}.${EXTENSION}\shell\${COMMAND}" "" "${DESCRIPTION}"
WriteRegStr HKCR "${APPLICATION}.${EXTENSION}\shell\${COMMAND}\command" "" "${ACTION}"
!macroend
I wanted to call it this way:
!insertmacro CreateShellCommand 'slcr' 'SLCRechner' 'open' 'Oeffnen' '"$INSTDIR\slcrechner.exe" "%1"'
Then I get the error:
Error: unterminated string parsing line at macro:CreateShellCommand:2
If I change the last parameter to '$INSTDIR\slcrechner.exe %1' everything is fine.
Can somebody help me understand the bug in my code?
Thanks,
Sascha
Afrow UK
9th June 2005 12:20 UTC
Imagine placing '"$INSTDIR\slcrechner.exe" "%1"' in "${ACTION}". It would become:
""$INSTDIR\slcrechner.exe" "%1""
Then you've got three paramaters with text in between...
"", " ", ""
-Stu
Lisasdad
9th June 2005 14:12 UTC
Hi,
thanks for the reply, but I can still not figure out how to do it.
If I leave out the quote marks and write ${ACTION} instead of "${ACTION}", it still doesn't work.
Now it complains: WriteRegStr expects 4 parameters, got 5.
How would I have to write a macro to pass a string containing quotes?
glory_man
9th June 2005 15:50 UTC
Try to use
WriteRegStr HKCR "${APPLICATION}.${EXTENSION}\shell\${COMMAND}\command" "" '${ACTION}'
and
!insertmacro CreateShellCommand 'slcr' 'SLCRechner' 'open' 'Oeffnen' '$INSTDIR\slcrechner.exe "%1"'
Lisasdad
9th June 2005 16:04 UTC
Great, it works. Thanks a lot.