Old 6th November 2007, 14:52   #1
Junior Member
Join Date: Nov 2007
Posts: 23
StringCompare if not empty

I use the following script to check for installation of the .NET Framework:


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

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?
martijntijn is offline   Reply With Quote
Old 6th November 2007, 17:09   #2
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
StrCmp $1 "" 0 loop

Afrow UK is offline   Reply With Quote
Old 6th November 2007, 17:10   #3
[NSIS Dev, Mod]
kichik's Avatar
Join Date: Oct 2001
Location: Israel
Posts: 11,343
StrCmp $1 "" 0 loop
This would be much easier with the LogicLib:
!include LogicLib.nsh
StrCpy $2 0
EnumRegKey $1 HKLM SOFTWARE\Microsoft\.NETFramework $2
${If} ${Errors}

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

IntOp $2 $2 + 1
${LoopWhile} $1 != ""

Or even better:


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
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