Archive: huh?


huh?
I honestly can't understand why in this code:


ReadRegStr $R0 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
StrCmp $R0 "Update" UpdateFound UpdateNotFound

UpdateNotFound:
MessageBox MB_OK|MB_ICONQUESTION "not found.. closing.. " IDOK
Quit

UpdateFound:
MessageBox MB_OK|MB_ICONQUESTION "result: $R0 " IDOK
quit

I see the as result "result: Update" as it should normaly happen but in this

ReadRegStr $R0 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
StrCmp $R0 "Update" UpdateFound UpdateNotFound

UpdateNotFound:
DetailPrint "Installing security update.."
SetDetailsPrint None
SectionIn R0

SetOutPath "$INSTDIR"
; some other stuff

UpdateFound:

it dosen't get me the same result. What the hell I'm doing wrong in code 2? Sorry but this realy pissed me off cos I just can't seem to find the problem..

That's because you didn't put a Goto, Abort, or Quit command before the UpdateFound label on the second case. On the first you did put a Quit command.


I've also tested with


ReadRegStr $1 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
StrCmp $1 "Update" UpdateFound
Goto UpdateFound

DetailPrint "Installing security update.."
SetDetailsPrint None

SectionIn RO
SetOutPath "$INSTDIR"
; stuff to do

UpdateFound:


before asking on the forum. But still dosen't seem to be working.. What should I add to "UpdateFound:" to let it continue the process then?

StrCmp $1 "Update" UpdateFound
Goto UpdateFound

Is the same as:
StrCmp $1 "Update" UpdateFound UpdateFound
So it won't work.

You should put the command Goto right before the label UpdateFound:
to go to the end. Like this below:

StrCmp $1 "Update" UpdateFound

# UpdateNotFound codes

Goto UpdateEnd

UpdateFound:

# UpdateFound codes

UpdateEnd:

Since I don't have something in the UpdateFound: part isn't exactly the same as what I've previously mentioned? Anyway, dosen't seem to be working..

Like this it should be or what?


Section "KB823980" SecKB823980

ReadRegStr $1 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
StrCmp $1 "Update" UpdateFound

DetailPrint "Installing security update.."

SectionIn RO
SetOutPath "$INSTDIR"
File "Windows2000-KB823980-x86-ENU.exe"
nsExec::Exec '"Windows2000-KB823980-x86-ENU.exe" -z -u'
Delete $OUTDIR\Windows2000-KB823980-x86-ENU.exe
SetDetailsPrint None
Goto UpdateEnd

UpdateFound:

UpdateEnd:

SectionEnd

Oh, sorry, my fault. The real code is:

IntCmp $1 "Update" UpdateFound

# UpdateNotFound codes

Goto UpdateEnd

UpdateFound:

# UpdateFound codes

UpdateEnd:

Still nothing.. any ideea?


Try:


SetCompressor lzma
XPStyle on

Name "Test"
OutFile "hi.exe"
InstallDir $EXEDIR
ShowInstDetails show

Section "-default"
ReadRegStr $1 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
StrCmp $1 "Update" UpdateFound NoUpdate

UpdateFound:
DetailPrint "Installing security update..."
#SetOutPath "$INSTDIR"
#File "Windows2000-KB823980-x86-ENU.exe"
#nsExec::Exec '"Windows2000-KB823980-x86-ENU.exe" -z -u'
#Delete $OUTDIR\Windows2000-KB823980-x86-ENU.exe
DetailPrint "you have installed a file!"
Goto Exit

NoUpdate:
DetailPrint "No update need"

Exit:
SectionEnd

Errrrmm.. still no. With


Name "windows test"
OutFile "test.exe"
Caption "windows test"
CRCCheck on
XPStyle on

Function .onInit

ReadRegStr $R0 "HKLM" "SOFTWARE\Microsoft\Updates\Windows 2000\SP5\KB823980" "Type"
MessageBox MB_OK|MB_ICONQUESTION "KB823980 result: $R0 " IDOK
quit

FunctionEnd

Section "-boo"

SectionEnd

It works.. look at the image.

But happens when the user don't have the update or the user has a different OS?


It's the same OS and pc.. mine. :)


I see the as result "result: Update" as it should normaly happen but in this ... it dosen't get me the same result
Probably for that question the answer would be a "MessageBox" laking in your code. And in all of your other codes you put the MessageBox except that one. What a big "concidence", isn't it? If this is not the problem, you really didn't explain the true problem.

Umm.. allright, here are the files. First is the test file..


and the second file is the thing I want to do..


I can't understand you. The 2nd code you posted on your first post is the answer to the question.

And second, are you trying to convert "bla.nsi" into "stuff.nsi"?

Explain to me!

W-h-a-t d-o y-o-u w-a-n-t m-e t-o d-o t-o h-e-l-p y-o-u, m-a-n?


I can't understand why in the bla.nsi (aka the test) I get the correct result but in the stuff.nsi (aka the thing where I want to use that ReadRegStr thing) is not working, as in I'm not getting the same result as in the bla.nsi wich are exactly the same lines. Undestood now?


Where are you putting the MessageBox on your second script when your test didn't work? Did this MessageBox appear or not? What did appear when it gave you error?

(Oh, just change the IntCmp back to StrCmp. At that day, I was about to kick my computer...:()


Yes, you are correct it dosen't exist there cos is not needed. I can see is not working cos I allways get it clicked via "SectionIn RO" wich is just in the "Update Not Found" part of the code, and in the "Update Found" aprt it should be unchecked. Would you like an screen capture of the result? :)