Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Custom Page (http://forums.winamp.com/showthread.php?t=267838)

Striker53 15th March 2007 17:27

Custom Page
 
Hi, I made a custom page and it works so far. My problem: At the custom page are two options. One to install and one to update. I want if one of them is marked install.nsh or update.nsh will be included. The .nsi file should only contain this lines. But i don´t become it working. Can you say me how i get it working? I hope you can understand my miserable English ^^

code:
Name "Miranda SE 1.65"

# Included files
!include MUI.nsh

# Installer pages
!insertmacro MUI_PAGE_WELCOME
Page custom cp1

Section Fields
ReadINIStr $R0 "cp1.ini" "Field 5" "State"
StrCmp $R0 1 +2
!include update.nsh

ReadINIStr $R0 "cp1.ini" "Field 6" "State"
StrCmp $R0 1 +2
!include install.nsh
SectionEnd

Function .onInit
InitPluginsDir
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "cp1.ini"
FunctionEnd

Function cp1 ;FunctionName defined with Page command
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "cp1.ini"
FunctionEnd


goldy1064 15th March 2007 17:44

!include is a compile-time command. It will always run so long as the !if*'s around it evaluate to true. What you want is two macros or functions and to invoke the correct one depending on the selection.

Red Wine 15th March 2007 17:45

You can't include a header at runtime.

edit:
we're posting coinstantaneously with goldy, sorry :)

Striker53 15th March 2007 17:52

Quote:

Originally posted by Red Wine
You can't include a header at runtime.
OK. I deleted it.

Quote:

Originally posted by goldy1064
What you want is two macros or functions and to invoke the correct one depending on the selection.
What for macros or functions? Sorry, i don´t understand :(

Red Wine 15th March 2007 18:24

Also, you may add the code straight to your section e.g.
code:
!include "LogicLib.nsh"

Section Fields
# If fields 5 & 6 are two radio buttons
# only one may be selected, so the code is:

ReadINIStr $R0 "cp1.ini" "Field 5" "State"
${If} $R0 == 1
# add here the code from update.nsh
${Else}
# add here the code from install.nsh
${EndIf}
SectionEnd


Striker53 15th March 2007 18:45

Thanks thanks thanks! :)


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

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.