Reference/!macro: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page with "=!macro= macro_name [parameter][...] Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !in...")
 
m (!macroend wiki link)
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  macro_name [parameter][...]
  macro_name [parameter][...]


Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !insertmacro. !macro definitions can have one or more parameters defined. The parameters may be accessed the same way a !define would (e.g. ${PARMNAME}) from inside the macro.
Creates a macro named '<code>macro_name</code>'. All lines between the <code>!macro</code> and the <code>[[Reference/!macroend|!macroend]]</code> will be saved. To insert the macro later on, use <code>[[Reference/!insertmacro|!insertmacro]]</code>. <code>!macro</code> definitions can have one or more parameters defined. The parameters may be accessed the same way a <code>[[Reference/!define|!define]]</code> would (e.g. <code>${PARMNAME}</code>) from inside the macro.


<highlight-nsis>!macro SomeMacro parm1 parm2 parm3
<highlight-nsis>!macro SomeMacro parm1 parm2 parm3
Line 10: Line 10:
   File "${parm3}"
   File "${parm3}"
!macroend</highlight-nsis>
!macroend</highlight-nsis>
''Command introduced with NSIS v1.8''

Latest revision as of 13:37, 12 December 2017

!macro

macro_name [parameter][...]

Creates a macro named 'macro_name'. All lines between the !macro and the !macroend will be saved. To insert the macro later on, use !insertmacro. !macro definitions can have one or more parameters defined. The parameters may be accessed the same way a !define would (e.g. ${PARMNAME}) from inside the macro.

!macro SomeMacro parm1 parm2 parm3
  DetailPrint "${parm1}"
  MessageBox MB_OK "${parm2}"
  File "${parm3}"
!macroend

Command introduced with NSIS v1.8