Archive: howto using macro


howto using macro
Hi,

call me stupid or something, but what i have to do with given macros ( http://nsis.sourceforge.net/RadioButtons#Macros )?
i don't know where to save this code to use it. can somebody give me one (or more) tipps?


http://nsis.sourceforge.net/Macro_vs_Function


I've seen this site before, it shows me how they work, but not how to implement. the question is, can i "outsourcing" the macro code to another file?


Yes you can do it in one or more headers (nsh) and include 'em in your main script e.g. !include "myheader.nsh"
You may want to take a look at the included within NSIS installation headers e.g. FileFunc.nsh would give you a start.


mmh, i already try that.... i will try it again. thx for help


Well, take a look here, download the full project and examine it, should be easier to go with it.

http://nsis.sourceforge.net/NSIS_Bey...nstallation_II


!include: closed: "C:\Program Files\NSIS\Include\LogicLib.nsh"
!macro: macro named "StartRadioButtons" already found!
!include: error in script: "RadioButtons.nsh" on line 10

I'd like me to be helpful, could you be more specific?


sorry, yes, ok, here what i want to do:

Maybe you know Daemon Tools for virtually mounting CDs/DVDs and awxDTools is a helpfull tool mounting CDs/DVDs directly from context menu. But there are some buggy problems (under vista) i want to change. one of them is the language selection via registry. so i want to create a tool, that can change the language. thats why i need radiobuttons.


Name "awxDTools Language Selector"

SetCompressor /SOLID lzma

# Defines
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 1.0
!define COMPANY "Torsten Burschka"
!define URL www.fantasquad.de/amt

# MUI defines
!define MUI_ICON awxDTools.ico
!define MUI_FINISHPAGE_NOAUTOCLOSE

# Included files
!include Sections.nsh
!include MUI.nsh
!include RadioButtons.nsh


The RadioButtons.nsh is the postat macro.

ps, ist an autogeneratet code, so some things might be not correct.

Well, $(^Name) might be useless because it might contain invalid characters for the registry, better use a string that you know it's gonna be acceptable, also writing to registry requires a root which might be defined as well e.g

!define REG_ROOT `HKCU`
!define REG_KEY `SOFTWARE\My Company\My Application`
RadioButtons is a macro included in NSIS header Sections.nsh, you do not need to include it as separate header while actually there is not such header named RadioButtons.nsh.
Even more, sections.nsh is a header dedicated to make the life easy regarding to control of components/sections, it won't help you do such things like you mentioned above.

my intension was this:

SectionGroup /e !Language SECGRP0000
Section "English - English" SEC0000
WriteRegStr HKEY_CURRENT_USER Software\arniWORX\awxDTools Language English
SectionEnd

Section /o "German - Deutsch" SEC0001
WriteRegStr HKEY_CURRENT_USER Software\arniWORX\awxDTools Language German
SectionEnd

Section "Dutch - Nederlands" SEC0002
WriteRegStr HKEY_CURRENT_USER Software\arniWORX\awxDTools Language Dutch
SectionEnd
SectionGroupEnd

This makes sense :)
Provided that you show the components page, include sections.nsh and use readiobuttons into .OnSelChange function to have only one section selected.
The included example one-section.nsi is almost identical for such a case.
It needs quotes here:
WriteRegStr HKEY_CURRENT_USER "Software\arniWORX\awxDTools" "Language" "English"


yes, but also one-section.nsi has the same problem with "already found"


This is weird, the example works pretty fine with or without logiclib included.
Just found an identical for your case example that I've posted here the other day.
Could you please copy/paste my code compile it and let us know if the same problem occurs?

http://forums.winamp.com/showthread....hreadid=267375


yepp, thats weird. your example works....


So what is this "RadioButtons.nsh"?
I suspect is a header that you've made which causes the conflict. If you have copied there the RadioButtons macros you don't need to do that, simply include the sections.nsh header.


yes, so it is. i think i will rewrite your code an implement it.

thx for your help.