Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   howto using macro (http://forums.winamp.com/showthread.php?t=269469)

torstenburschka 13th April 2007 06:48

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?

Red Wine 13th April 2007 07:03

http://nsis.sourceforge.net/Macro_vs_Function

torstenburschka 13th April 2007 07:09

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 13th April 2007 07:20

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.

torstenburschka 13th April 2007 07:22

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

Red Wine 13th April 2007 07:34

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

torstenburschka 13th April 2007 09:28

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


Red Wine 13th April 2007 10:54

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

torstenburschka 13th April 2007 11:56

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.

code:

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 13th April 2007 16:03

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
code:
!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 13th April 2007 16:13

my intension was this:

code:
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 13th April 2007 16:21

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"

torstenburschka 13th April 2007 16:25

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

Red Wine 13th April 2007 16:39

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

torstenburschka 13th April 2007 18:27

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

Red Wine 13th April 2007 18:40

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.

torstenburschka 13th April 2007 18:44

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

thx for your help.


All times are GMT. The time now is 04:58.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.