Skip to content
⌘ NSIS Forum Archive

Help woth InstallDirRegKey

13 posts

Dygear#

Help woth InstallDirRegKey

I am reading this value, c:\valve\steam\steamapps\dygear@aol.com\half-life, from HKCU "Software\Valve\Steam" "ModInstallPath"

but i want to get, c:\valve\steam\steamapps\dygear@aol.com, is there a way to do that?
Dygear#
Ok searched for Steam, and this is the most approte thread i could find. [link]
What i want to do is take the value from ModInstallPath and get the parent forlder. then set that to the Insall path.
I am going to try and make up some code later, but in that time if you could help with this then that would be great, I will no doubt have some qustions on how to do this later.
Dygear#edited
That code seems over kill.
This is what i want to do.
  1. That whats in the ModInstallPath and put in in to a variable.
  2. Take that var and GetParent.
  3. Set that as the INSTALL DIR.


I want to do back to the email address, not to [Drive:]/[DIR]/steam.
pengyou#
; Read registry value into $1
; for example, $1 = "c:\valve\steam\steamapps\dygear@aol.com\half-life"

Push $1
Call GetParent
Pop $0

; $0 = "c:\valve\steam\steamapps\dygear@aol.com"
Dygear#
; Start of Setting Install Dir
Function GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd

Var InstallDir ;Declare the variable

Section InstallDir
StrCpy $InstallDir ReadRegStr HKCU Software\Valve\Steam ModInstallPath
Push $9
Call getParent
Pop $9
SectionEnd
; End of Setting Install Dir
Can some one tell me why this is not working?
zimsms#
change:

StrCpy $InstallDir ReadRegStr HKCU Software\Valve\Steam ModInstallPath
to:
ReadRegStr $0 HKCU "Software\\Valve\\Steam" "ModInstallPath"
StrCpy $INSTDIR "$0"
; or
Var $InstallDir
ReadRegStr $InstallDir HKCU "Software\\Valve\\Steam" "ModInstallPath" 
Dygear#
;Hope this works !
Function GetParent
Exch $0 ; old $0 is on top of stack
Push $1
Push $2
StrCpy $1 -1
loop:
StrCpy $2 $0 1 $1
StrCmp $2 "" exit
StrCmp $2 "\" exit
IntOp $1 $1 - 1
Goto loop
exit:
StrCpy $0 $0 $1
Pop $2
Pop $1
Exch $0 ; put $0 on top of stack, restore $0 to original value
FunctionEnd

Var InstallDir
Section InstallDir
ReadRegStr $InstallDir HKCU "Software\Valve\Steam" "ModInstallPath"
Push $InstallDir
Call GetParent
Pop $0
SectionEnd

InstallDir "$0"
This should work :fingerscrossed:
Nope ... god this sucks.
Dygear#
Heres my code ...
kichik#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.