Old 29th June 2012, 17:11   #1
WindBridges
Junior Member
 
Join Date: May 2011
Posts: 11
How to pass empty string as macro parameter?

For example
code:
!macro TestMacro param1 param2
Push param1
Push param2
!macroend

!insertmacro TestMacro "" "test"



this code raises an error - Push expects 1 parameters, got 0. It happens because param1 is replaced by nothing, in result we have Push call without any parameters. How do you resolve this problem?
WindBridges is offline   Reply With Quote
Old 29th June 2012, 17:54   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
!macro TestMacro param1 param2
Push `${param1}`
Push `${param2}`
!macroend

Use quotes around the values (` is recommended because ' and " are more commonly used within strings).

Stu
Afrow UK is offline   Reply With Quote
Old 29th June 2012, 20:06   #3
WindBridges
Junior Member
 
Join Date: May 2011
Posts: 11
Great! Thank you.
WindBridges is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
empty string, macro

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump