CRegistry Class Description
The CRegistry class manages saving and retrieving data using the Windows Registry. The Windows Registry is a large database where Windows stores its configurations and information for software like Mira. You can use this feature to save and retrieve information used in scripts.
The registry is organized to hold values inside keys. The keys are organized in a hierarchical structure containing other keys. Values exist in the registry as keyword-value pairs in which the keyword identifies the information help in the value. For example, sWindowName="My_Name" is an example of a Registry value in which sWindowName is the keyword that identifies the information and "My_Name" is the actual data held by the value.
Information stored by the CRegistry class exists as keywords below the following level of the Windows Registry:
HKEY_CURRENT_USER\Software\Mirametrics\Mira\Params
A registry key must be opened to access (save, retrieve, or delete) keyword-value pairs under the key. For example, using the key named "MyKey" above, the two registry value sWindowName="My_Name" andnPlotIndex=2 would be saved as follows:
HKEY_CURRENT_USER\Software\Mirametrics\Mira\Params\MyKey\sWindowName="My_Name "
HKEY_CURRENT_USER\Software\Mirametrics\Mira\Params\MyKey\nPlotIndex=2
To access these values, open the key "MyKey" and the use class methods to access the values using the keyword of the keyword-value pairs. The locationHKEY_CURRENT_USER\Software\Mirametrics\Mira\Params should never be specified.
Registry keywords are always strings. Registry values available to the CRegistry class have the following types:
integer
real
string
boolean
RGB
These values are set or retrieved using by specifying the key and value name in the appropriateGet...() and Set...() methods included in this class.
Working with the CRegistry class is straightforward:
Create a CRegistry object using new_registry or CRegistry:new constructor or use the CRegistry:Open method. If a key name is passed as a parameter, the key is opened for use. If no parameter is passed to new_registry or new, the method must be followed by passing the registry key as a parameter to CRegistry:Open.
Read values from the open key using one of the Get...() methods.
Save values to the open key using one of the Set...() methods.
When finished using a key, close the CRegistry object using the delete or Close method.
To permanently delete a registry key, use DeleteKey.
To permanently delete a registry value, use DeleteValue.
Construction |
Object = new_registry( sKeyName )
Object = CRegistry:new( sKeyName ) Object = CRegistry:Open( sKeyName ) |
Destruction |
Object:delete() Object:Close() |
This function is normally used to create a new CRegistry object as an alternative to the class-based new method.
Global function that creates a new CRegistry object. Pass either the key name string or another CRegistry object to automatically open the registry key. |
Opens a key by creating a new CRegistry object that is an instance of the CRegistry class. Same as Open. |
|
Opens a key by creating a new CRegistry object that is an instance of the CRegistry class. Same as new. |
|
Deletes the CRegistry object. Same as Close. |
|
Deletes the CRegistry object. Same as delete. |
|
Deletes a registry key and all its subkeys and values. |
|
Deletes a registry value inside a key |
Returns a Boolean (true or false) value |
|
Sets a keyword (name) to a Boolean (true or false) value. |
|
Returns an integer value. |
|
Sets a keyword (name) to an integer value. |
|
Returns a numeric (real number) value. |
|
Sets a keyword (name) to a numeric (real number) value. |
|
Returns an RGB string value. |
|
Sets a keyword (name) to an RGB string value |
|
Returns a string value |
|
Sets a keyword (name) to a string value. |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.