GetRegistryValue(root, subfolder, name, warn)
Reads a value from the Windows system registry. This can be quite useful if you install your Analytica model as part of a larger application, and if your model needs to find certain data files on the user's computer (for example, for use with ReadTextFile or RunConsoleProcess). The locations of those files could be stored in the registry by your installer, so that your model knows where to look.
- GetRegistryValue(root : atomic textual; subfolder, name: optional atomic textual; warn: optional atomic boolean)
«Root» must be one of:
«Subfolder» specifies the path from the root to the folder containing the key of interest. The levels of the path may be separated by
\. If the root is
"HKLM" and the subfolder begins with
"ANAVER", the Analytica application folder is used, for example:
"ANA" → "Software/Lumina Decision Systems/Analytica" and
"ANAVER" → "Software/Lumina Decision Systems/Analytica/3.2". (Note: In a private label version, the path mapped to by
ANA will be different.)
If the root is
"HKCU" and the subfolder begins with
"ANA", the Analytica folder for the current user is used ("Software/Lumina Decision Systems/Analytica" (again, this path is different in a private label version). Examples of these would be:
GetRegistryValue("HKLM", "ANAVER", "home")
GetRegistryValue("HKCU", "ANA/MOT", "rootdir")
«Name» specifies the value name within the subfolder to retrieve.
The following registry data types are recognized and are returned as the indicated Analytica type
REG_EXPAND_SZ: Returned as Text
REG_DWORD: Returned as Numeric
REG_MULTI_SZ: Returned as a null-indexed list of text strings.
REG_NONE: Returned as Null (without warning)
- Any other: An embedded warning is issued and Null returned.
If the subfolder or value is not found, a warning is issued, null returned. The various warnings that might occur can be suppressed either by setting the optional «warn» parameter to
False, or by wrapping the function call in an IgnoreWarnings function.
This function cannot be used to alter or enumerate registry data. Analytica does not provide a function to change registry data.