Archive: StringCompare if not empty


StringCompare if not empty
I use the following script to check for installation of the .NET Framework:


StrCpy $2 0
loop:
EnumRegKey $1 HKLM Software $2
StrCmp $1 "v2.0.50727" done
IntOp $2 $2 + 1
!StrCmp $1 "" loop
MessageBox MB_OK "NoMsFramworkInstalled"
done:


I want to loop trough my Registry is the key 'v2.0.50727' exists. Every key I compare with "v2.0.50727". When true go to 'done', when false reloop.

[Line 6] If $1 is not empty, reloop. What is the right syntax for this line? And will this code work?

StrCmp $1 "" 0 loop

Stu


StrCmp $1 "" 0 loop
This would be much easier with the LogicLib:
!include LogicLib.nsh
#...
StrCpy $2 0
${Do}
ClearErrors
EnumRegKey $1 HKLM SOFTWARE\Microsoft\.NETFramework $2
${If} ${Errors}
${Break}
${EndIf}

${If} $1 == "v2.0.50727"
MessageBox MB_OK found
${Break}
${EndIf}

IntOp $2 $2 + 1
${LoopWhile} $1 != ""
Or even better:

http://nsis.sourceforge.net/Get_.NET_Version