Archive: Install from regkey help


Install from regkey help
I don't understand how to use the InstallDirRegKey code. Please help!

basically, I want ONLY this section of my installer to check the regkey to see if and where windowblinds is installed, and if it is installed, installe the files there, if it's not installed then install it to a folder in the desktop. (There's 12 sections in my installer, but I only want it applying to this section, not all the other things)

But I don't know how to incorporate the InstallDirRegKey command into the section. Here's the section code for this, but no idea where to add the regcode stuff properly cuz I'm a noob ; Any help would be very much appreciated, thanx.

-----------------------------------------------------

Section "Windowblinds Skins" Section9


; Set Section properties

SetOverwrite on

; Check Registry

InstallDir $DESKTOP\Windowblinds\
InstallDirRegKey HKLM SOFTWARE\Stardock\Windowblinds\WB5.ini\INSTALLED "RealPath"


; Set Section Files and Shortcuts

File "WindowBlinds Skins\Panther.Uis"
File "WindowBlinds Skins\Panther.txt"

SectionEnd


----------------------------------------------------------


Instead of using InstallDirRegKey on a section you could do (with this code below, you can remove the InstallDir command you put):

ReadRegStr $INSTDIR HKLM SOFTWARE\Stardock\Windowblinds\WB5.ini\INSTALLED "RealPath"
IfFileExists $INSTDIR +2
StrCpy $INSTDIR "$DESKTOP\Windowblinds\"

K, so how would I type that all in that section? I have nooooo idea ;) haha. Can ya show me using the script e.g. I supplied in top post? (Like I said, I'm a total noob at all this NSIS stuff. Thanx.

Also, this is the registry key, so also not sure if i have that top part right either:

-----------------regkey from registry-----------------

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Stardock\WindowBlinds\WB5.ini\INSTALLED]
"RealPath"="C:\\Program Files\\Stardock\\Object Desktop\\WindowBlinds"
"Path3"="430"
"ver"="4.30"
"Path"="Object Desktop"
"Path2"="WB-g1de774"
--------------------------------------------------------------


k, I tried that code ya put:

ReadRegStr $INSTDIR HKLM SOFTWARE\Stardock\Windowblinds\WB5.ini\INSTALLED "RealPath"
IfFileExists $INSTDIR +2
StrCpy $INSTDIR "$DESKTOP\Windowblinds\"

it didnt do anything during the install...I think it checked the reg key cuz it didnt install teh folder on the desktop, but it didn't install it to the regkey's installed folder either ( isearched harddrive, it didnt install it anywhere) Any ideas?


Anyone?


Hm.... did you set the output path? (I assume not because it's never mentioned on this page)

The quick solution: SetOutPath $INSTDIR
(after the ReadRegStr bit already mentioned)

But... I can forsee some potential problems... You mentioned you only want this special directory handling to apply to this section (other sections get installed to somewhere else) so you're going to have to save where that somewhere else is, so you will end up using $INSTDIR for two different things. That's probably not going to work (if it's what you plan).

So, long story short, maybe you could try this (it might take some adapting, but you get the idea):

ReadRegStr $0 HKLM SOFTWARE\Stardock\Windowblinds\WB5.ini\INSTALLED "RealPath"
IfFileExists $0 +2
StrCpy $0 "$DESKTOP\Windowblinds"
SetOutPath $0

Thanx KrYpT, that worked great. Last question though..

what if I check for that key example "HKLM SOFTWARE\Stardock\Windowblinds\WB5.ini\INSTALLED "RealPath"

....and the "realpath" part in the registry is "c:\programfiles\object desktop\windowblinds\"

..how would i then have it install to "c:\programfiles\object desktop\windowblinds\skins" folder?


Put this before SetOutPath $0.

StrCpy $0 "$0\skins"

Thanx, all working great now. Appreciate teh help.