matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Tips
quote: Originally posted by Plan-1130
Accessing the registry, without getting errors (see attachment):
Both variable and path should not begin with a slash (/).
ExistsRegistry (
[optional string] sub directory in the script's registry key,
[optional string] variable in the script's registry key
)
Returns true if exists, false if not exists
DeleteRegistry (
[optional string] sub directory in the script's registry key,
[optional string] variable to remove, if not set, the whole directory will be removed
)
Deletes a variable or key.
ReadRegistry (
[optional string] sub directory in the script's registry key,
[optional string] variable to read from,
[optional string] default value in case the variable is not set yet
)
Reads the value of a key or variable, returns the value if found, returns default value if set, returns null if failed.
WriteRegistry (
[optional string] sub directory in the script's registry key,
[optional string] variable to read from,
[string] value to write,
[boolean] whether or not to overwrite if set already
)
Writes a value to a key or variable, returns the written value if overwrite is true or value did not exist, returns original value if overwrite is false and value did exist, returns null if failed.
Examples:
code: ExistsRegistry("example", "MyAge");
// returns false
ReadRegistry("example", "MyAge");
// returns null
WriteRegistry("example", "MyAge", 16);
// writes 16, returns 16
ExistsRegistry("example", "MyAge");
// returns true
WriteRegistry("example", "MyAge", 17, false);
// does not write, returns 16
DeleteRegistry("example", "MyAge");
// deletes value
ReadRegistry("example", "MyAge", 17);
// writes 17, returns 17
WriteRegistry("example", "MyAge", 18);
// writes 18, returns 18
DeleteRegistry("example");
// deletes whole example key
I posted a registry module already that uses the Windows API http://shoutbox.menthix.net/attachment.php?pid=738349
|
|