Skip to content
⌘ NSIS Forum Archive

Passing macro output destination

5 posts

Lodester#

Passing macro output destination

I'm wondering, is there some way I can pass a control to a macro in order to use that as a parameter to direct output from within the macro?

!macro SayMessageTo MyMessageBox String
${NSD_SetText} $MyMessageBox "${String}"
!macroend
Obviously the above is invalid code, but i am looking for a way to re-use a lot of common code calls across multiple forms that will have different display controls without having to bloat lines for simple return output

So following my bad example would be something like

Function Message
!insertmacro SayMessageTo $Message1 "Hello World"
FunctionEnd
In order to get "Hello World" set to $message1 control

Is something like this possible?
Once again i think there would be a simple answer, but thanks for your help and patience
MSG#
Macros are just text-replacement tools. So yes, what you want is possible:

!macro SayMessageTo MyMessageBox String
${NSD_SetText} $${MyMessageBox} "${String}"
!macroend
MSG#
hmmm, yes, that makes a lot more sense. I was for some reason thinking MyMessageBox would contain the name of the variable... That's not a very likely scenario is it. >__<