Registry.GetValue

string Registry.GetValue ( 

number  MainKey,

string  SubKey,

string  Value,

boolean AutoExpand = true )

Example 1

reg_data = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "InstallPath", false);

Gets the data in the "InstallPath" value found in "HKEY_LOCAL_MACHINE\Software\My Application" and stores it in a variable called "reg_data."

Example 2

-- Set the data "Saved Value" in the user's Registry.
Registry.SetValue(HKEY_CURRENT_USER, "Software\\My Application", "MyValue", "Saved Value", REG_SZ);

-- Read the previously written value.
registry_value = Registry.GetValue(HKEY_CURRENT_USER, "Software\\My Application", "MyValue", true);

-- Display the value read from the Registry in a dialog.
Dialog.Message("Registry Data", "The value read from the Registry is "..registry_value..".");

Sets the "MyValue" value's data to the string "Saved Value". The value is located in "HKEY_CURRENT_USER\Software\My Application" and will have a value of REG_SZ. That value is then read back and displayed in a dialog.

Note: _ProgramFilesFolder is a built-in variable that contains the path to the user's Program Files folder.

Example 3

-- Add a value to the registry.
Registry.SetValue(HKEY_CURRENT_USER, "Software\\My_Application", "User_Temp", "%Temp%", REG_EXPAND_SZ);

-- Get the unexpanded and expanded values.
sRaw = Registry.GetValue(HKEY_CURRENT_USER, "Software\\My_Application", "User_Temp", false);
sExpanded = Registry.GetValue(HKEY_CURRENT_USER, "Software\\My_Application", "User_Temp", true);

-- Output retrieved data to the user.
Dialog.Message("Temporary Directory", "Raw Data: " .. sRaw .. "\r\n" .. "Expanded Data: " .. sExpanded);

Adds the windows environment variable %Temp% to the registry as a REG_EXPAND_SZ value.  Retrieves both the unexpanded and expanded contents of this registry value and outputs them to the user.

See also:  Related Actions