Old 9th June 2010, 02:21   #1
Binxalot
Junior Member
 
Join Date: Jul 2007
Posts: 3
Question Driving me mad, what is $0 and how to I use it?

Hello, I tried reading up on the documentation for NSIS but the documentation just dives right into using $0 without explaining what it is or how it works and I can't wrap my head around what is probably a very simple thing.

What is the $0 variable/function what is it? and how does it work in code?

I have this function I found to check for .Net framework and download it from the microsoft web site if it's not installed on the machine. I wanted to expand the code to also check for XNA framework using the XNA framework's registry key but when I make my installer it always pops up a window to install XNA even though it's already installed on my machine.

I've been trying to troubleshoot this myself but I need to know what is $0???? I have a feeling that $0 cannot be used to check for XNA. But I can't find any information about $0 or $1 or anything to help me figure this out in the normal documentation..

Here is my code:

code:
ReadRegDWORD $0 HKLM 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5' Install
${If} $0 == ''
StrCpy $InstallDotNET "Yes"
MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} requires that the .NET Framework 3.5 is installed. The .NET Framework will be downloaded and installed automatically during installation of ${PRODUCT_NAME}."
Return
${EndIf}

ReadRegDWORD $0 HKLM 'SOFTWARE\Microsoft\XNA\Framework\v3.1' Install
${If} $0 == ''
StrCpy $InstallXNAFramework "Yes"
MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} requires the XNA Framework to function properly. The XNA Framework will be downloaded and installed automatically during installation of ${PRODUCT_NAME}."
Return
${EndIf}




And later down the script file...

code:

; Get .NET if required
${If} $InstallDotNET == "Yes"
SetDetailsView hide
inetc::get /caption "Downloading .NET Framework 3.5" /canceltext "Cancel" "http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe" "$INSTDIR\dotNetFx35setup.exe" /end
Pop $1

${If} $1 != "OK"
Delete "$INSTDIR\dotNetFx35setup.exe"
Abort "Installation cancelled."
${EndIf}

ExecWait "$INSTDIR\dotNetFx35setup.exe"
Delete "$INSTDIR\dotNetFx35setup.exe"

SetDetailsView show
${EndIf}

; Get XNA if required
${If} $InstallXNAFramework == "Yes"
SetDetailsView hide
inetc::get /caption "Downloading XNA Framework 3.1" /canceltext "Cancel" "http://download.microsoft.com/download/5/9/1/5912526C-B950-4662-99B6-119A83E60E5C/xnafx31_redist.msi" "$INSTDIR\xnafx31_redist.msi" /end
Pop $2

${If} $2 != "OK"
Delete "$INSTDIR\xnafx31_redist.msi"
Abort "Installation cancelled."
${EndIf}

ExecWait "$INSTDIR\xnafx31_redist.msi"
Delete "$INSTDIR\xnafx31_redist.msi"

SetDetailsView show
${EndIf}

Binxalot is offline   Reply With Quote
Old 9th June 2010, 05:02   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
http://nsis.sourceforge.net/Docs/Chapter2.html#2.3.5.2

It's all right there in the manual.
MSG is offline   Reply With Quote
Old 9th June 2010, 09:52   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
HKLM 'SOFTWARE\Microsoft\XNA\Framework\v3.1' Install exists and it's a DWORD?

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump