Old 21st September 2010, 17:45   #1
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Red face A macro calling a macro is invalid?

Being purist that I am, I use the following technique to implement a single function for both install and uninstall sections, without writing it twice:

PHP Code:
!macro MACROFUNC un0
Function ${un0}MyFunc
  
# NSIS code that works perfectly well.
FunctionEnd
!macroend
!insertmacro MACROFUNC ""
!insertmacro MACROUNFUNC "un." 
Calling MyFunc and un.MyFunc from a script works perfectly, if it is a direct call:
PHP Code:
  Push "somestring"
  
call MyFunc 
However, when I try to further "macrosize" the above by:
PHP Code:
!macro MACRO_INST param
  Push 
${param}
  
call MyFunc
!macroend 
So that I can call the function in a single line:
PHP Code:
MACRO_INST "somestring" 
NSIS compiler fails with an error:
Quote:
Invalid command: MACRO_INST
What am I doing wrong? What am I missing?

Thanks.
nsnb is offline   Reply With Quote
Old 21st September 2010, 17:56   #2
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
you need to call the macro properly..
PHP Code:
!insertmacro MACRO_INST "somthing" 
To make it easier to read, make a define:
PHP Code:
!define MACRO_INST "!insertmacro MACRO_INST"
${MACRO_INST"somthing" 
Zinthose is offline   Reply With Quote
Old 21st September 2010, 18:00   #3
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Lightbulb

OK, the following does work:
PHP Code:
!insertmacro MACRO_INST "somestring" 
as documented in the manual.

I forgot the !insertmacro. Sorry for the false alarm.
nsnb is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
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