Archive: have problems trying to understand functions


have problems trying to understand functions
here is what i am trying to do:

On the componet page i want them to be able to select and unselect windows media player install. but i want the installer to check to see what version of windows and to run the correct install function (WMP is one of many sections i would like them to be able to choose from)

here is what i have (witch doesnt work because you cant have functions in sections)

Subsection "video programs" SEC03

section "vobsub" SEC31
sectionend

section "quicktime" SEC32
sectionend

Section "Windows Media Player 9" SEC33
Function MPinstall
Call GetWindowsVersion
Pop $R0
StrCmp $R0 "XP" XPinstall Wininstall

xpinstall
File "C:\Documents and Settings\PMoriarty\My Documents\windows stuff\MPsetupxp.exe
ExecWait "$instdir\MPsetupxp.exe"
Delete "$instdir\MPsetupxp.exe"

Wininstall
File "C:\Documents and Settings\PMoriarty\My Documents\windows stuff\MPsetup.exe"
ExecWait "$instdir\MPsetup.exe"
Delete "$instdir\MPsetup.exe"
FunctionEnd
SectionEnd
Section divx SC34
Subsectionend

i have all my functions twords the end of the script and am useing the windows version check thats in the appendix part of nsis manual.

any help would be appriciated.


sorry forgot correct nsi file
sorry forgot to save nsi before posting


You don't need to put a function in a section. Sections can run code too.

The code you've posted missed colons after the label names. It's also missing code that will tell it to skip the regular "Wininstall" after it executes "XPInstall". The code should look like:

StrCmp $0 "value" label1
# do stuff if $0 != value
goto done
label1:
# do stuff if $0 == value
done: