NSIS: Functions, the easy way
Installers November 27th, 2007Most functions in NSIS require that you push variables first and then call the function (Call function).
However, there’s another way that’s more easy, but requires some preparation.
This is the function:
[code]
Function Dump
Exch $5
StrCpy $LogTemp "$LogTemp$r$n$5"
FunctionEnd
[/code]
It concatenates a pushed variable (String in my case) with a variable $LogTemp and stores it in $LogTemp, similar to the ++ operation.
Normally you would have to use it like this:
[code]
Push "Test"
Call Dump
[/code]
Now, put on top of your script following code:
[code]
/**
* Initialization for function Dump
*/
!macro _dump STRING
Push "${STRING}"
call Dump
!macroend
!define Dump '!insertmacro "_dump"'
[/code]
Now you can call the function like this:
[code]
${Dump} ".onInit"
[/code]
Follow Me!