Archive: Newbie question


Newbie question
  I am a newbie to NSIS. Could somebody please help me with this code.
I am trying to check if sql anywhere is installed ,if it is,I need to write a field in the ini file for each version(e.g 5,6,7,8) to retrieve in custom dialog(e.g SQL 8,SQL7...) to allow user to select the sql version installation.
Somehow even if I don't have verison 8 in the registry,Field gets written in the ini file. any help appreciated.
Sorry,it might be a stupid question but I looked everywhere for help.
Thanks in advance. Code attached( I have seperate function for each sql version)
Function IsAnywhere7Installed
Push $R0
ClearErrors
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SQL Anywhere Studio 7.0" ""
IfErrors lbl_na
StrCpy $R0 1
Goto lbl_end
lbl_na:
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "install" " none"
;WriteINIStr "$PLUGINSDIR\IO.ini" "Settings" "NumFields" " 5"
StrCpy $R0 0
lbl_end:
;Exch $R0
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Type" " radiobutton"
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Text" " SQL Anywhere Studio 7.0"
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Left" " 110"
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Right" " -10"
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Top" " 70"
WriteINIStr "$PLUGINSDIR\IO.ini" "Field 5" "Bottom" " 80"
WriteINIStr "$PLUGINSDIR\IO.ini" "Settings" "NumFields" " 5"

FunctionEnd


I made some changes in your code (try this code, and post if it works or not):


IsAnywhere7Installed 


Push $R0
ClearErrors
ReadRegStr $R0 HKLM "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\SQL Anywhere Studio 7.0" "UninstallString"

IfErrors 0 lbl_end
StrCpy $R0 1
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "install" "none"
;WriteINIStr "$PLUGINSDIRIO.ini" "Settings" "NumFields" "5"
StrCpy $R0 0
Goto end

lbl_end:

;Exch $R0
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Type" "radiobutton"
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Text" "SQL Anywhere Studio 7.0"
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Left" "110"
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Right" "-10"
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Top" "70"
WriteINIStr "$PLUGINSDIRIO.ini" "Field 5" "Bottom" "80"
WriteINIStr "$PLUGINSDIRIO.ini" "Settings" "NumFields" "5"

>End:

>FunctionEnd
>

You might want to have a look at this Archive directory page:
http://nsis.sourceforge.net/archive/...instances=0,11

It's called Database Functions.


Thank you for your reply. I will check it today.