Old 6th November 2007, 14:52   #1
martijntijn
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:

code:

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

Stu
Afrow UK is offline   Reply With Quote
Old 6th November 2007, 17:10   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
code:
StrCmp $1 "" 0 loop
This would be much easier with the LogicLib:
code:
!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

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
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