ssCore.Registry.getValue

Retrieve a string or numeric value (in string format) for a specified value name associated with a registry key.


Availability:

First available in version 3.0 build 2039.


Input Parameters:

rootKey - The name of one of the main branches of the registry. Valid values include: HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_USERS, HKEY_LOCAL_MACHINE, HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG, and HKEY_DYN_DATA.

subKey - The name of the key to be accessed. This key must be a subkey of the rootKey.

valueName - The name of the value to be retrieved from the specified subkey. Leave the valuename blank to retrieve the {Default} value for the specified subkey.


Output Parameters:

type - Indicates the type of data returned.

result - The retrieved value or an empty string (in the case of an error).


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.Registry.getValue( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.Registry.getValue( paramsObject );


Notes:

None.


Examples:

var return_obj = ssCore.Registry.getValue({rootKey:"HKEY_CURRENT_USER", subKey:"Software\\Test", valueName:"MyValue"});

ssDebug.trace(return_obj.result);
ssDebug.trace(return_obj.type);

When getting a value that is the REG_MULTI_SZ type use _global.fromMultiString for ActionScript 1, StringUtils.fromMultiString for ActionScript 2, or StringUtils.fromMultiString for ActionScript 3 to convert the returned value into a format that you can use.

import northcode.utils.StringUtils;

var return_obj = ssCore.Registry.getValue({rootKey:"HKEY_CURRENT_USER", subKey:"Software\\Test", valueName:"MyValue"});

var values = StringUtils.fromMultiString(return_obj.result);

// The return value from fromMultiString is an array.

ssDebug.trace(values.toString());