PDA

View Full Version : Registry SubKey w/ Variables


Sheritlw
09-27-2004, 10:34 AM
How do you use variables in subkeys.
I've tried several combinations to see if I could get the results I'm looking for and haven't had any success yet. Below is an example of my last attempt.
Any suggestions?

Registry.SetValue(HKEY_USERS, ".DEFAULT\Software\SessionVar.Expand(%CompanyName%) \SessionVar.Expand(%RegistryName)", "Version", SessionVar.Expand("%ProductVer%"), REG_SZ);

Ted Sullivan
09-27-2004, 10:43 AM
Try this. It should do what you want. It assumes that you have set the session variables %CompanyName% and %RegistryName% at some previous point.


SubKey = ".DEFAULT\\Software\\" .. SessionVar.Expand("%CompanyName%") .. "\\" .. SessionVar.Expand("%RegistryName");
Value = "Version";
Data = SessionVar.Expand("%ProductVer%");

Registry.SetValue(HKEY_USERS, SubKey, Value, Data, REG_SZ);


Here is a link to more information and examples on using the actions SessionVar.Expand (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/SessionVar.Expand.htm) and Registry.SetValue (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/Registry.SetValue.htm).