Archive: setting parent directory as default from registry


setting parent directory as default from registry
Hey im having some difficulty setting the parent directory as the user's prompting directory.

Let me explain, as i went here but it didnt answer exactly what i wanted to do.

okay, i want to go into the registry and take from HKCU "Software\Valve\Steam" ModInstallPath 's data. Once i have that, i can get the dir (c:\games\steam\steamapps\[steamaccount]\half-life) so i can get the parent directory and change the new path to C:\games\steam\steamapps\[steamaccount]\counter-strike.

While it seems that it is a simple task to do, the problem i am running into is actually setting this as the default that the user gets when they select the directory, as opposed to just doing this without user intervention. I've tried all day to get this to work, and im feelin pretty frustrated right now...


You should get this info before you show the directory page and set the $INSTDIR, or if using a different variable for directory page the variable you are using, to the value of the prossesed path before showing the directory selection page.

Vytautas


ive tried that however i seem to have a problem because you would need to do this as a function or section and i cannot get them to work with InstallDir/InstallDirRegKey because that cannot be decalred within a function/section and ReadRegString and other similars can only be decalred within one...

can someone give me some pseudo code to work with please?


You can change $INSTDIR without InstallDir and InstallDirRegKey. Wherever a variable is accepted, $INSTDIR is accepted too. For example:

Function .onInit
StrCpy $INSTDIR "C:\forced\path"
FunctionEnd