- NSIS Discussion
- huh?
Archive: huh?
dork
8th August 2004 20:41 UTC
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..
deguix
8th August 2004 21:59 UTC
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.
dork
9th August 2004 15:42 UTC
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?
deguix
9th August 2004 16:29 UTC
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:
dork
11th August 2004 16:07 UTC
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
deguix
11th August 2004 16:16 UTC
Oh, sorry, my fault. The real code is:
IntCmp $1 "Update" UpdateFound
# UpdateNotFound codes
Goto UpdateEnd
UpdateFound:
# UpdateFound codes
UpdateEnd:
dork
12th August 2004 17:02 UTC
Still nothing.. any ideea?
Joel
12th August 2004 17:41 UTC
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
dork
13th August 2004 16:34 UTC
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.
Joel
13th August 2004 17:31 UTC
But happens when the user don't have the update or the user has a different OS?
dork
13th August 2004 20:19 UTC
It's the same OS and pc.. mine. :)
deguix
13th August 2004 21:19 UTC
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.
dork
14th August 2004 12:54 UTC
Umm.. allright, here are the files. First is the test file..
dork
14th August 2004 12:55 UTC
and the second file is the thing I want to do..
deguix
14th August 2004 15:17 UTC
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?
dork
14th August 2004 21:05 UTC
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?
deguix
14th August 2004 23:19 UTC
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...:()
dork
15th August 2004 07:36 UTC
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? :)