ijerkovi
11th August 2003 22:51 UTC
Detecting Installed Application
I have this fragment of code that does not seem to work:
;cView Section
Section "Crystal Reports Viewer" CRViewer info
ReadRegStr $0 HKCU "SOFTWARE\Sand\Third\cView" "Installed"
IfErrors lblNoApp lblAlreadyInstalled
lblNoApp:
SetOutPath "$INSTDIR\sw\cV81"
File "sw\cV81\*.*"
ExecWait '"$INSTDIR\sw\cV81\setup.exe " /sms'
WriteRegStr HKCU "SOFTWARE\Sand\Third" "cView" "Installed"
lblAlreadyInstalled:
MessageBox MB_OK "cView already installed!"
SectionEnd
I check the value in registry and is there. If I try to run installer again it does not detect that app has been installed.
Any help is appreciated.
Joel
12th August 2003 00:59 UTC
Why not ...
ReadRegStr $0 HKCU "SOFTWARE\Sand\Third\cView" "Installed"
StrCmp $0 "" NoInstall YesInstall
NoInstall:
;Here the code if no installed
YesInstalled:
;Here the code if installed
kichik
12th August 2003 13:04 UTC
Make sure the error flag is clear before you execute instructions you later wish to check for errors. Use the ClearErrors instruction before ReadRegStr.
ijerkovi
12th August 2003 15:33 UTC
Tried both ideas did not work!
Thanks for the two ideas above but it still does not work...
;--------------------------------
;cView Section
Section "Crystal Reports Viewer" CRViewer info
ClearErrors
ReadRegStr $0 HKCU "SOFTWARE\Sand\Third\cView" "Installed"
StrCmp $0 "" NoInstall YesInstall
NoInstall:
;Here the code if not installed
SetOutPath "$INSTDIR\sw\cV81"
File "sw\cV81\*.*"
ExecWait '"$INSTDIR\sw\cV81\setup.exe " /sms'
WriteRegStr HKCU "SOFTWARE\Sand\Third" "cView" "Installed"
YesInstall:
;Here the code if installed
MessageBox MB_OK "cView already installed!"
SectionEnd
kichik
12th August 2003 15:35 UTC
You are reading and writing from different keys.
If you are reading from here:
ReadRegStr $0 HKCU "SOFTWARE\Sand\Third\cView" "Installed"
Writing here is not the right place:
WriteRegStr HKCU "SOFTWARE\Sand\Third" "cView" "Installed"
It should be:
WriteRegStr HKCU "SOFTWARE\Sand\Third\cView" "Installed" "1"
ijerkovi
12th August 2003 15:47 UTC
It was better...almost there
It seems that both sections get executed (e.g. YesInstall & NoInstall)..
;--------------------------------
;cView Section
Section "Crystal Reports Viewer" CRViewer info
ClearErrors
ReadRegStr $0 HKCU "SOFTWARE\Sandvine\Third\cView" "Installed"
StrCmp $0 "" NoInstall YesInstall
YesInstall:
;Here the code if installed
MessageBox MB_OK "cView already installed!"
NoInstall:
;Here the code if not installed
SetOutPath "$INSTDIR\sw\cV81"
File "sw\cV81\*.*"
ExecWait '"$INSTDIR\sw\cV81\setup.exe " /sms'
WriteRegStr HKCU "SOFTWARE\Sandvine\Third\cView" "Installed" "1"
SectionEnd
kichik
12th August 2003 15:52 UTC
That would be because you're not skipping NoInstall if YesInstall is executed. You should put Goto done at the end of the YesInstall part and a label called done at the end of the section.
ijerkovi
12th August 2003 15:57 UTC
Thanks !!
You are a genious!