CRegistry:Open
The Open method constructs a new instance of a CRegistry object. The key to open must be passed, either as a string or by passing another CRegistry object containing the key name. After creating the new key, you can use the Get() and Set() methods to access its values. This is a replacement for the new method and new_registry function.
C = CRegistry:Open( sKeyName ) Creates a new CRegistry object by opening the named key. C = CRegistry:Open( CRegistry2 ) This is a copy constructor. It opens a new CRegistry R initialized to the key used by CRegistry2. |
Two overloads are provided for this method. They open a registry key or create separate access to the same key. You must provide a key name as a parameter. If the named key exists it is opened. If it does not exist it is created. A new key will not be saved to the Registry unless you use one of the Set() methods. The new method is equivalent to the new method, so you can use either the new / delete pair or the Open / Close pair to open and close the key.
The following script opens a key and retrieves the radius parameter. If the radius value does not exist in the Registry, the default value of 5.2 is returned.
|
-- open registry key "MyKey" |
|
-- fetch the "radius" value, default to 5.2 |
|
-- return value if it exists, else return 5.2 |
|
-- result: Rad= 15.125 (already exists) |
|
-- close access to the key |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.