Skip to content
⌘ NSIS Forum Archive

howto using macro

17 posts

torstenburschka#

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?
torstenburschka#
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?
Red Wine#
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.
Red Wine#
Well, take a look here, download the full project and examine it, should be easier to go with it.

torstenburschka#
!include: closed: "C:\Program Files\NSIS\Include\LogicLib.nsh"
!macro: macro named "StartRadioButtons" already found!
!include: error in script: "RadioButtons.nsh" on line 10
torstenburschka#
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.
Red Wine#
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.
torstenburschka#
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
Red Wine#
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"
Red Wine#
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?

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Red Wine#
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.