Old 5th April 2007, 09:20   #1
DrDan
Member
 
Join Date: Apr 2007
Location: London, UK
Posts: 58
!insertmacro inside !macro

Hi,

I have been trying to insert three macros inside another macro definition like this:

!macro Macro1 Arg1 Arg2
;Do stuff with Arg1 and Arg2
!macroend

!macro Macro2 Arg1 Arg2
;Do stuff with Arg1 and Arg2
!macroend

!macro Macro3 Arg1 Arg2
;Do stuff with Arg1 and Arg2
!macroend

!macro Macro4 Arg1 Arg2
!insertmacro Macro1 ${Arg1} ${Arg2}
!insertmacro Macro2 ${Arg1} ${Arg2
!insertmacro Macro3 ${Arg1} ${Arg2}
!macroend

Macro1, Macro2, Macro3 and Macro4 all take two arguments only.

Unfortunately, the compiler complains with the error

!insertmacro: macro "Macro1" requires 2 parameter(s), passed 4!

the first time I "!insertmacro Macro4" I can't quite see why this doesn't work.

My questions are:

1) Is it possible to nest macros in this way, and if so what am I doing wrong?
2) If it is not possible, what is the best alternative way to achieve the same effect.

Thanks in advance.
DrDan is offline   Reply With Quote
Old 5th April 2007, 09:23   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
You forgot the quotes

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 5th April 2007, 09:40   #3
DrDan
Member
 
Join Date: Apr 2007
Location: London, UK
Posts: 58
Doh!! Thanks! I knew it was something obvious. Here is what I needed to do:

!macro Macro4 Arg1 Arg2
!insertmacro Macro1 "${Arg1}" "${Arg2}"
!insertmacro Macro2 "${Arg1}" "${Arg2}"
!insertmacro Macro3 "${Arg1}" "${Arg2}"
!macroend
DrDan is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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